Search⌘ K

Rolling Back Failed Deployments

Understand the reasons for rolling back Kubernetes deployments, including critical bugs and failed Pod creations. Learn how to verify deployment status with kubectl rollout commands and use automated checks to decide when to undo failed updates.

Why should we roll back?

Discovering a critical bug is probably the most common reason for a rollback. Still, there are others. For example, we might be in a situation where Pods cannot be created. An easy to reproduce case would be an attempt to deploy an image with a tag that does not exist. Let’s update the definition of our image and deploy it again:

Let's update the definition of our Image and deploy it again.

Shell
kubectl set image -f go-demo-2-api.yml api=vfarcic/go-demo-2:does-not-exist --record

The output is as follows:

Shell
deployment "go-demo-2-api" image updated

After seeing such a message, you might be under the impression that everything is working properly. However, that output only indicates that the definition of the image used in the Deployment was successfully updated. That does not mean that the Pods behind the ...