转载链接:https://www.kubernetes.org.cn/5906.html

我本人看到这几个常用命令,分享下:
滚动升级相关命令,记得加上对应的命名空间

$ kubectl set image deploy/nginx nginx=nginx:1.7.9 --record
$ kubectl set image deploy/nginx nginx=nginx --record
$ kubectl rollout status deploy nginx #查看升级状态
$ kubectl rollout pause deployment nginx #升级暂停
$ kubectl rollout resume deployment nginx #恢复升级
$ kubectl describe deploy nginx #查看升级详情
$ kubectl rollout history deploy/nginx #查看升级历史
deployment.extensions/nginx
REVISION CHANGE-CAUSE
4 kubectl set image deploy/nginx nginx=nginx:1.7.9 --record=true
5 kubectl set image deploy/nginx nginx=nginx --record=true
$ kubectl rollout history deployment nginx --revision=5
$ kubectl rollout undo deployment/nginx --to-revision=4 #回滚到指定版本
$ kubectl rollout undo deployment nginx-deploy #回滚到前一个版本