How to Perform a Rollback
A moment ago, we used kubectl apply
to perform a rolling update on a Deployment. We used the --record
flag so that Kubernetes would maintain a documented revision history of the Deployment. The following kubectl rollout history
command shows the Deployment with two revisions.
$ kubectl rollout history deployment hello-deploy deployment.apps/hello-deploy REVISION CHANGE-CAUSE 1 <none> 2 kubectl apply --filename-deploy.yml --record=true
Revision 1
was the initial deployment that used the latest
image tag. Revision 2
is the rolling update we just performed, and we can see that the command we used to invoke the update has been recorded in the object's history. This is only there because we used the --record
flag as part of the command to invoke the update. This might be a good reason for you to use the --record
flag.
Earlier in the chapter, we said that updating a Deployment creates a new ReplicaSet, and that any previous ReplicaSets...