Kubernetes 滚动升级
run test deploy
[root@k8s-master ~]# kubectl run --image=nginx --port=80 --replicas=2 test-nginx
scale replica
[root@k8s-master ~]# kubectl scale --replicas=1 deploy/test-nginx [root@k8s-master ~]# kubectl get deploy NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE busybox 2 2 2 2 39d busybox1 1 1 1 1 39d test-nginx 1 1 1 1 2h
update image
[root@k8s-master ~]# kubectl set image deploy/test-nginx test-nginx=nginx:alpine
查看升级历史
[root@k8s-master ~]# kubectl rollout history deploy/test-nginx deployments "test-nginx" REVISION CHANGE-CAUSE 1 <none> 2 <none>
回顾至上次版本
[root@k8s-master ~]# kubectl rollout undo deploy/test-nginx [root@k8s-master ~]# kubectl rollout history deploy/test-nginx deployments "test-nginx" REVISION CHANGE-CAUSE 2 <none> 3 <none>
回滚至指定版本
[root@k8s-master ~]# kubectl rolloutundo deployment/lykops-dpm --to-revision=2
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.