Kubernetes · Orchestration under pressure
How do rollbacks work and what are their limits?
Short answer
Kubernetes keeps ReplicaSet revisions so you can roll a Deployment back to a previous pod template. Rollbacks do not undo database migrations or external configuration changes.
Each Deployment revision corresponds to a pod template. kubectl rollout undo switches the Deployment back to a previous ReplicaSet, which then scales up while the current one scales down. revisionHistoryLimit controls how many old ReplicaSets are retained.
- Rollback restores the pod template, not ConfigMaps, Secrets or CRs
- Images must still exist and be pullable
- Database changes are not reverted automatically
- A rollback is itself a rolling update and needs capacity and readiness
- Store manifests in Git so the desired state and rollback history are auditable
kubectl rollout history deployment/api
kubectl rollout undo deployment/api
kubectl rollout undo deployment/api --to-revision=3
kubectl rollout status deployment/apiRollback is a recovery mechanism, not a substitute for forward-compatible delivery. If a release includes a destructive migration, rolling back the app can leave it incompatible with the database. Expand-and-contract migrations and feature flags make rollback safe.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What exactly does a Deployment rollback restore?
- 2Why can a database migration make rollback unsafe?
- 3How does revisionHistoryLimit affect rollback options?
- 4How would you roll back a ConfigMap change?
Say it in the interview
Kubernetes stores Deployment revisions as ReplicaSets, so a rollback re-applies a previous pod template. It does not revert ConfigMaps, Secrets or database migrations, which is the usual trap. I keep enough revision history and make schema changes backward compatible so rollback is actually safe. I also treat rollback as a rolling update that needs capacity and readiness.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Kubernetes mock interview and get scored feedback on depth, clarity and confidence.