Menu

Dipesh Majumdar

Blog and Paintings

How to rollback a deployment in Kubernetes

$ kubectl -n mynamespace describe deploy nginx |grep -i image
    Image:        nginx:2.7.1
$ kubectl -n mynamespace rollout history deploy nginx
deployment.extensions/nginx
REVISION  CHANGE-CAUSE
2         <none>
3         <none>
4         <none>

$ kubectl -n mynamespace rollout undo deploy nginx --to-revision=3
deployment.extensions/nginx rolled back
$ kubectl -n mynamespace rollout history deploy nginx
deployment.extensions/nginx
REVISION  CHANGE-CAUSE
2         <none>
4         <none>
5         <none>

$ kubectl -n mynamespace describe deploy nginx |grep -i image
    Image:        nginx:1.7.8

Go Back

Comment