Home

application lifecycle management

Updates and Rollbacks in deployments

//rollout
kubectl rollout status deployment/mydeployment

//history and revisions
kubectl rollout history deployment/mydeployment

Deployment strategies

  1. Recreate strategy :Destroy old version and deploy new version
    • application downtime
  2. Rolling update: older version are taken down one by one with adding a new version. (Default strategy)
apiVersion: v1
kind: Deployment
metadata:
    name: myapp-deployment
    lables:
        app: myapp
        type: frontend
spec:
    template:
        metadata:
        name: myapp-pod
        labels:
            app: myapp
            type: frontend
        spec:
            containers:
            - name: nginx-container
              image: nginx:1.7.1
    replicas: 3
    selector:
        matchlabels:
            type: frontend
kubectl apply -f deplyment-definition.yaml
//imperative way
kubectl set image deployment/myapp-deployment nginx-controller=nginx:1.7.1

Upgrade:

A new replica set is created during the upgradation of pods. And with each pod in the old Replicaset, a new pod is created while the older one is taken down.

Rollback:

kubectl rollout undo deployment/my-deployment