Rolling update can ensure the continuity of business because during the update there are copies running all the time.

demo:
create Deployment httpd
create ReplicaSet httpd-8*
create three Pods
now the version of image is 2.2.31
k8s rolling update and rolling back

vertify the yaml as httpd:2.2.32 and apply yaml

k8s rolling update and rolling back

the Deployment httpd 's image updates 2.2.32
the Replicaset updates 2.2.32,which has 3 Pods
the newest Pods are in the Replicaset 2.2.32

k8s rolling update and rolling back

each time update only one Pod ,the old ReplicaSet scales down from 3 to 0,the new ReplicaSet scales up from 0 to 3

Rolling back

kubectl applying will save a configuration in revision which can be used to roll back.

demo:

apply deployment three times

k8s rolling update and rolling back
kubectl rollout history deployment httpd
to see the version,we can roll back to certain version 1 and 4

kubectl rollout undo deployment httpd --to-revision=4

k8s rolling update and rolling back

相关文章: