Kubernetes cluster Practice (09) rolling updates and rollbacks

Rollover is a small part of an update, and then successfully updated more copies, the final completion of all versions of the update, which when deployed ElasticSearch ECK is such updates, its biggest advantage is zero downtime, ensure business continuity. Common practice is to modify the image file yaml field, set to the new version, simple operation, not described in detail here, but this chapter is mainly notes contents rollback.
To do is yaml in the preparation of documents, to increase spec.revisionHistoryLimit property, by default Kubernetes command retention recent revision, this property can be modified to increase the number of revision (usually the default is enough).
Bring --recored parameters in the implementation of the deployment yaml file, for example:

kubectl apply -f traefik-deploy-v1.yaml --record

Its role is to record the current command to the revision log, so you can know each revision corresponds to which file. By file viewing revision history

kubectl rollout history daemonset traefik

Wherein 'daemonset' traefik type of deployment, 'CHANGE-CAUSE is --record results. If you want to roll back to a version, such as revision 4, execute the following command:

kubectl rollout undo daemonset traefik --to-revision=4

Recommendation: Be sure to add --record parameters when kubectl apply.

Guess you like

Origin blog.51cto.com/huanghai/2481126