Roll Back a Deployment¶
When to Use This Guide¶
Use this guide when a new deployment version introduces errors and you need to quickly restore a previously working version.
Rolling back deployments is common when:
- a new application release causes failures
- a container image update breaks functionality
- configuration changes introduce errors
Quick Commands
Common Rollback Tasks¶
| Task | Command |
|---|---|
| View rollout history | kubectl rollout history deployment web-app |
| Roll back to previous version | kubectl rollout undo deployment web-app |
| Roll back to specific revision | kubectl rollout undo deployment web-app --to-revision=2 |
| Check rollout progress | kubectl rollout status deployment web-app |
Step 1 — View Deployment History¶
Check previous deployment versions.
Example:
Step 2 — Roll Back the Deployment¶
Restore the previous working revision.
Kubernetes replaces the current pods with the previous version.
Step 3 — Verify Rollback Status¶
Check rollout progress.
Then confirm pods are running.
Common Issues¶
Rollback Does Not Fix the Problem
Possible causes:
- configuration issue still present
- external dependency failure
- database migration mismatch
Inspect logs:
Quick Rollback Workflow
kubectl rollout history deployment web-app
kubectl rollout undo deployment web-app
kubectl rollout status deployment web-app
Related Guides¶
Deployment Management - Scale a Deployment - Restart a Deployment - Update Container Image
Troubleshooting
- Debug a Crashing Pod