在线升级仅支持小版本的相关的升级,不支持大版本的升级
#master
#确定要升级的版本
yum list --showduplicates kubeadm --disableexcludes=kubernetes
#升级masetr
yum install -y kubeadm-1.21.x-0 --disableexcludes=kubernetes
#验证版本
kubeadm version
#验证升级计划
kubeadm upgrade plan
#进行版本升级
kubeadm upgrade apply v1.21.x
#驱逐节点
kubeadm upgrade apply v1.21.x
#进行升级
yum install -y kubelet-1.21.x-0 kubectl-1.21.x-0 --disableexcludes=kubernetes
#重启k8s
sudo systemctl daemon-reload
sudo systemctl restart kubelet
#取消节点保护
kubectl uncordon <node-to-drain>
#node
#升级kubeadm
yum install -y kubeadm-1.21.x-0 --disableexcludes=kubernetes
#d调用kubeadm进行升级
sudo kubeadm upgrade node
#驱逐节点
kubectl drain <node-to-drain> --ignore-daemonsets
#进行升级
yum install -y kubelet-1.21.x-0 kubectl-1.21.x-0 --disableexcludes=kubernetes
#重启k8s
sudo systemctl daemon-reload
sudo systemctl restart kubelet
#取消驱逐
kubectl uncordon <node-to-drain>
kubectl get nodes
标签:kubectl,在线,--,disableexcludes,升级,kubeadm,k8s,1.21
From: https://www.cnblogs.com/yutoujun/p/16914865.html