Video in progress
What does it mean to roll back after a deploy?
A rollback means returning the application to the last working version when the new one causes problems. The goal is to rescue users first and find the cause later, calmly.
📖 Answer
Say 1.5.0 went out and the error count shot up. Instead of rushing a code fix, going back to 1.4.0 with one command is faster and safer.
kubectl rollout history deploy/shop-api
kubectl rollout undo deploy/shop-api # to the previous version
kubectl rollout undo deploy/shop-api --to-revision=7 # to a specific revision
To make rollback easy, you need to prepare in advance:
- the image of every version should be kept in the registry under an exact tag (you cannot go back with
latest); - DB changes should be such that the old code can still work with them.
The second one hurts the most: if the new version dropped a column, going back to the old code does not help. That is why teams make a habit of doing migrations carefully, in steps.
Sign up to mark studied questions and save your progress.