kubeadm升级k8s集群
更新:HHH   时间:2023-1-7


1、查看集群版本:

查看可升级的集群版本

yum list --showduplicates kubeadm --disableexcludes=kubernetes
yum install -y kubeadm-1.16.3-0 --disableexcludes=kubernetes    #所有节点
kubeadm  version

kubeadm upgrade plan    #查看集群是否可以升级,升级后各组件的版本信息

2、下载升级的各个镜像<所有节点>

kubeadm config images list | sed -e 's/^/docker pull /g' -e 's#k8s.gcr.io#registry.cn-hangzhou.aliyuncs.com/google_containers#g' | sh -x
docker images | grep registry.cn-hangzhou.aliyuncs.com/google_containers | awk '{print "docker tag",$1":"$2,$1":"$2}' | sed -e 's/registry.cn-hangzhou.aliyuncs.com\/google_containers/k8s.gcr.io/2' | sh -x
docker images | grep registry.cn-hangzhou.aliyuncs.com/google_containers | awk '{print "docker rmi """$1""":"""$2}' | sh -x

3、升级集群

kubeadm upgrade apply v1.16.3

master节点进行升级:

kubeadm upgrade node

升级各个组件

yum install -y kubelet-1.16.3 kubectl-1.16.3 --disableexcludes=kubernetes
systemctl daemon-reload
systemctl restart kubelet

4、升级worker节点

kubeadm upgrade node
yum install -y kubelet-1.16.3 kubectl-1.16.3 --disableexcludes=kubernetes
systemctl daemon-reload
systemctl restart kubelet

返回云计算教程...