Deployment回滚(二)
2023-05-01 14:24:42 来源: 腾讯云
(资料图)
回滚到之前的版本
如果我们想要回滚到之前的某个版本,我们可以使用以下命令查看Deployment的更新历史记录:
kubectl rollout history deployment/nginx-deployment
这将输出类似于以下内容的信息:
deployment.apps/nginx-deployment REVISION CHANGE-CAUSE1 kubectl create -f nginx-deployment.yaml --record=true2 kubectl set image deployment/nginx-deployment nginx=nginx:1.17 --record=true3 kubectl set image deployment/nginx-deployment nginx=nginx:1.16 --record=true
我们可以看到Deployment共进行了3次滚动更新,我们可以回滚到任意一个版本。假设我们想要回滚到步骤3:回滚Deployment
如果新版本出现问题,您需要快速回滚Deployment。Deployment提供了回滚机制,可以使您快速回到先前的稳定版本。回滚Deployment会自动启动Rollback操作,它会撤消Deployment中的所有更改,并将其回滚到先前的版本。回滚将不断重试,直到所有Pod都达到先前的版本。
在我们的示例中,我们将回滚Deployment以将它恢复到早期版本。
检查Deployment状态:
$ kubectl rollout status deployment hello-deployment
回滚Deployment:
$ kubectl rollout undo deployment hello-deployment
检查回滚状态:
$ kubectl rollout status deployment hello-deployment
输出:
Waiting for deployment "hello-deployment" rollout to finish: 1 out of 3 new replicas have been updated...Waiting for deployment "hello-deployment" rollout to finish: 1 out of 3 new replicas have been updated...Waiting for deployment "hello-deployment" rollout to finish: 2 out of 3 new replicas have been updated...Waiting for deployment "hello-deployment" rollout to finish: 2 out of 3 new replicas have been updated...deployment "hello-deployment" successfully rolled out
您可以看到回滚Deployment后,状态已恢复到早期版本。
标签:
[责任编辑:]
猜你喜欢
- (2023-05-01)环球今头条!dns和dhcp服务器的作用_dhcp服务器的作用
- (2023-05-01)“五一”假期首日北京两机场两项数据创历史新高 今亮点
- (2023-05-01)颛怎么读拼音_颛怎么读
- (2023-05-01)44%民众不挺2025非核家园 王美花回应
- (2023-05-01)【当前独家】湖人如何打勇士?哈姆透露3个战术,詹姆斯表示认同,浓眉豪言4-2
- (2023-05-01)骄傲!“五一”光荣榜来啦,婺城这些集体和个人上榜! 全球微资讯
- (2023-05-01)LPL赛区MSI历史记录出炉:小虎胜场数最高,RNG三冠无敌手