Kubernetes Rollbacks
Inspect Deployment revision history, undo rollouts, annotate change causes, and pause or resume updates safely.
Why Rollbacks Matter
Even with testing, some releases fail in production. Kubernetes rollbacks let you return to a known good version quickly.
See Rollout History
kubectl rollout history deployment/web
Roll Back to the Previous Revision
kubectl rollout undo deployment/web
Roll Back to a Specific Revision
kubectl rollout undo deployment/web --to-revision=2
Record Why a Change Happened
A helpful habit is adding a human-readable change cause.
kubectl annotate deployment web kubernetes.io/change-cause="upgrade nginx to 1.28"
When you inspect history later, that extra context is valuable.
Pause and Resume Rollouts
kubectl rollout pause deployment/web
kubectl rollout resume deployment/web
Pausing is useful when you want to make several spec changes before triggering another rollout.
A Safe Upgrade Workflow
kubectl annotate deployment web kubernetes.io/change-cause="upgrade nginx to 1.28"
kubectl set image deployment/web nginx=nginx:1.28
kubectl rollout status deployment/web
kubectl rollout history deployment/web
If something breaks:
kubectl rollout undo deployment/web
Why This Is Better Than Manual Repair
Rollbacks are fast because the Deployment controller already knows the older ReplicaSet definition.
Think of rollback like using version history in a document editor instead of trying to remember every deleted paragraph manually.
Undo Command
Which command rolls a Deployment back to the previous revision?
Pause Benefit
Why would you pause a rollout?