K8s集群版本升级

升级管理节点:
1、查找最新版本号
yum list --showduplicates kubeadm
2、升级kubeadm
yum install -y kubeadm-1.23.0-0
3、驱逐node上的pod,且不可调度
kubectl drain master.lab.example.com --ignore-daemonsets
4、检查集群是否可以升级,并获取可以升级的版本
kubeadm upgrade plan
如果遇到报错:[ERROR CoreDNSUnsupportedPlugins]: start version '' not supported
[ERROR CoreDNSMigration]: CoreDNS will not be upgraded: start version '' not supported

 

 执行如下命令跳过这两个参数就行:kubeadm upgrade plan --ignore-preflight-errors=CoreDNSUnsupportedPlugins,CoreDNSMigration

 
5、执行升级
kubeadm upgrade apply v1.23.0  --ignore-preflight-errors=CoreDNSUnsupportedPlugins,CoreDNSMigration
6、升级kubelet和kubectl
yum install -y kubelet-1.23.0-0 kubectl-1.23.0-0
7、重启kubelet
systemctl daemon-reload
systemctl restart kubelet
8、取消不可调度,重新上线
kubectl uncordon  master.lab.example.com
 
 
---------------------------------------------------------------------
升级node节点:
1、升级kubeadm
yum install -y kubeadm-1.23.0-0
2、驱逐node上的pod,且不可调度
kubectl drain node1.lab.example.com --ignore-daemonsets
3、升级kubelet配置
kubeadm upgrade node
4、升级kubelet和kubectl
yum install -y kubelet-1.23.0-0 kubectl-1.23.0-0
5、重启kubelet
systemctl daemon-reload
systemctl restart kubelet
6、取消不可调度,重新上线
kubectl uncordon node1.lab.example.com 
--------------------------------------------------------------------------
升级后截图:

 

 

 
posted @ 2022-08-27 00:31  cloud-qing0212  阅读(828)  评论(0编辑  收藏  举报