Rolling Back
Part of the Introduction to Kubernetes section of Coddy's Terminal journey. Lesson 15 of 45.
Every image update creates a new revision of the Deployment, and Kubernetes remembers the previous ones:
kubectl rollout history deployment/webThe table lists each REVISION number. Revision 1 is the original, revision 2 the first update, and so on.
If the new version turns out to be broken, go back to the previous revision with one command:
kubectl rollout undo deployment/webKubernetes answers deployment.apps/web rolled back and rolls the old image out again, Pod by Pod, exactly like an update.
A rollback is itself a new revision, so the history keeps growing and you can always see what happened. To jump to a specific revision, add --to-revision=1.
Challenge
BeginnerCreate a Deployment named web from the nginx image and update its nginx container to nginx:1.27. Then show the rollout history and roll the Deployment back.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Introduction to Kubernetes
4Deployments
Creating A DeploymentScalingDeployments From ManifestsUpdating ImagesRolling BackRecap - Deployment ManagerPractice on your own: Terminal playground