k8s rolling update and rolling back

本文探讨了在Kubernetes中使用滚动更新确保业务连续性的方法,通过逐步替换Pod实现无中断升级。同时,介绍了如何利用Kubernetes的配置修订历史进行应用回滚,以及使用Helm进行应用程序级别的容器更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值