This is an old revision of the document!


Deployments, finally we have reached to the last major object in Kubernetes. Deployments take everything we have being doing so far and encapusaltes it. What I mean is the following:

Of course you can have more than 1 pod in replica set. Yes, it is replica set when under Deployment, not replication controller. But the purpose is the same.

So let's create our Deployment now:

To create a deployment again we have two ways:

  • Iterative - With kubectl create and so on
  • Declarative - Using YML / JSON file, I will be using this one.

As I am bored with the iterative way, let's clean our env and create a deployment. I won't delete my service as I will use it later.

First, let's create our YML file:

Create Deployment YML file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-deploy
spec:
  replicas: 10
  selector:
    matchLabels:
      app: hello-date
  template:
    metadata:
      labels:
        app: hello-date
    spec:
      containers:
      - name: hello-pod
        image: andonovj/httpserverdemo:latest
        ports:
        - containerPort: 1234
  • k8s_basic_deployments.1588434953.txt.gz
  • Last modified: 2020/05/02 15:55
  • by andonovj