Skip to content

Latest commit

 

History

History
73 lines (59 loc) · 2.08 KB

File metadata and controls

73 lines (59 loc) · 2.08 KB

Deployments

In this section, we will take a look at kubernetes deployments

Deployment is a kubernetes object.

  • The Deployment provides us with the capability to upgrade the underline instances seemlessly using Rolling updates, Undo Changes and Pause and Resume Changes as required.

    deployment

How do we create deployment?

  • As with the previous components we created a defination file, the content of the deployment defination file is similar to replicaset defination file. Except with the kind which is now going to be Deployment.
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: myapp-deployment
      labels:
        app: myapp
        type: front-end
    spec:
     template:
        metadata:
          name: myapp-pod
          labels:
            app: myapp
            type: front-end
        spec:
         containers:
         - name: nginx-container
           image: nginx
     replicas: 3
     selector:
       matchLabels:
        type: front-end
  • Once the file is ready, create the deployment using deployment defination file

    $ kubectl create -f deployment-defination.yaml
    
  • To see the created deployment

    $ kubectl get deployment
    
  • The deployment automatically creates a ReplicaSet. To see the replicasets

    $ kubeclt get replicaset
    
  • The replicasets ultimately creates PODs. To see the PODs

    $ kubectl get pods
    

    deployment1

  • To see the all objects at once

    $ kubectl get all
    

    deployment2

K8s Reference Docs: