148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

marco.cirilli
from marco.cirilli More from this publisher
19.06.2021 Views

Chapter 8 ■ Using Rolling UpdatesFigure 8-32. Only some of the replicas are availableIf some deployment has an error, the deployment may be rolled back to an earlier revision. List thedeployment revisions.kubectl rollout history deployment/mysql-deploymentThe deployment revisions are listed as shown in Figure 8-33.Figure 8-33. Listing deployment revisions195

Chapter 8 ■ Using Rolling UpdatesWe need to find which deployment revision does not have an error and subsequently roll back to thatrevision. The details of a revision can be displayed. For example, the following command lists the detail ofrevision 4:kubectl rollout history deployment/mysql-deployment --revision=4The details of revision 4 are listed as shown in Figure 8-34.Figure 8-34. Listing the details of revision 4To roll back to the previous version, run the following command, assuming the rollbackTo->revisionfield is set to 0 (also the default) in the deployment definition file:kubectl rollout undo deployment/mysql-deploymentDeployment is rolled back as shown in Figure 8-35. List the pods, and you may see some of the pods stillnot running, which indicates that the revision rolled back to has errors.196

Chapter 8 ■ Using Rolling Updates

We need to find which deployment revision does not have an error and subsequently roll back to that

revision. The details of a revision can be displayed. For example, the following command lists the detail of

revision 4:

kubectl rollout history deployment/mysql-deployment --revision=4

The details of revision 4 are listed as shown in Figure 8-34.

Figure 8-34. Listing the details of revision 4

To roll back to the previous version, run the following command, assuming the rollbackTo->revision

field is set to 0 (also the default) in the deployment definition file:

kubectl rollout undo deployment/mysql-deployment

Deployment is rolled back as shown in Figure 8-35. List the pods, and you may see some of the pods still

not running, which indicates that the revision rolled back to has errors.

196

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!