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
vertify the yaml as httpd:2.2.32 and apply yaml
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
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
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
we can use helm to update the application-level container in k8s:
install mysql chart,and set parameter
upgrade chart:
update successfully,
helm history can shows version of releases
helm rollback can rollback release to certain version