Rollback restores a Kubernetes Deployment to a previous recorded revision after a change introduces a bug or otherwise requires rapid reversal. Kubernetes creates a new revision whenever pods change; undoing a revision creates another revision rather than decreasing the revision number. section 5.1.3
Use this operational sequence to reverse a problematic Deployment change:
- Inspect revisions with kubectl rollout history deploy <name>. section 5.1.3
- Record the reason for a change with the kubernetes.io/change-cause annotation. section 5.1.3
- Revert the Deployment with kubectl rollout undo deploy <name>. section 5.1.3
- Verify completion with kubectl rollout status deploy <name>, then annotate the new revision when useful. section 5.1.3
Reverting a faulty image update
After changing the Apache image and discovering a bug, run kubectl rollout undo deploy apache. The Deployment returns to the previous application version, while its history records the rollback as a new revision. Add the note reverted back to the original and confirm success with kubectl rollout status deploy apache.







