Rollback and rolling updates are a feature of Deployment object in the Kubernetes.
We do the Rollback to an earlier Deployment revision if the current state of the Deployment is not stable due to the application code or the configuration.
Each rollback updates the revision of the Deployment.
○ → kubectl get deploy
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
nginx 1 1 1 1 15h
○ → kubectl rollout history deploy nginx
deployment.extensions/nginx
REVISION CHANGE-CAUSE
1 <none>
2 <none>
kubectl undo deploy <deploymentname>
○ → kubectl rollout undo deploy nginx
deployment.extensions/nginx
○ → kubectl rollout history deploy nginx
deployment.extensions/nginx
REVISION CHANGE-CAUSE
2 <none>
3 <none>
We can also check the history of the changes by the below command:
kubectl rollout history deploy <deploymentname>