How to Roll Back Kubernetes Deployments

How to Roll Back Kubernetes Deployments (the Right Way)

Sometimes you deploy a change... and something goes wrong. The good news? Kubernetes makes it easy to roll back to a previous version of your Deployment — no panic required!

Here’s how you do it:

1️⃣ Check Deployment History

First, check the revision history for your Deployment:

kubectl rollout history deployment <deployment-name>

This shows you a list of revisions — each time you deploy or change your Deployment, Kubernetes creates a new revision.

2️⃣ Roll Back to Previous Revision

If your latest deployment is problematic, simply roll back:

kubectl rollout undo deployment <deployment-name>

This reverts to the previous known-good revision.

3️⃣ Roll Back to a Specific Revision

Want to roll back to a specific version (not just the last one)? Use:

kubectl rollout undo deployment <deployment-name> --to-revision=<revision-number>

You can find the revision number in the history from step 1.

4️⃣ Monitor Rollback Progress

Once you start the rollback, monitor progress:

kubectl rollout status deployment <deployment-name>

Why Use Rollbacks?

Quick recovery from bad releases this happens quite ofte.

No downtime (handled as a rolling update)

No need to reapply old manifests manually we just go back to previous version