将测试集群从 1.16 升级到 1.17
1、查找当前1.17最新版本为 1.17.17-0
yum list --showduplicates kubeadm --disableexcludes=kubernetes
2、更新kubeadm
yum install -y kubeadm-1.17.17-0 --disableexcludes=kubernetes
3、验证 kubeadm 版本:
kubeadm version
4、腾空当前控制节点
kubectl drain 172.16.100.30 --ignore-daemonsets
5、检查可用于升级到哪些版本,并验证您当前的集群是否可升级
kubeadm upgrade plan
6、升级当前控制节点
kubeadm upgrade apply v1.17.17-0
7、升级网络插件
For Kubernetes v1.16
kube-flannel.yaml uses ClusterRole & ClusterRoleBinding of rbac.authorization.k8s.io/v1. When you use Kubernetes v1.16, you should replace rbac.authorization.k8s.io/v1 to rbac.authorization.k8s.io/v1beta1 because rbac.authorization.k8s.io/v1 had become GA from Kubernetes v1.17.
For Kubernetes v1.17+
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
8、取消对节点的保护
kubectl uncordon 172.16.100.30
9、升级控制节点上的 kubelet 和 kubectl
yum install -y kubelet-1.17.17-0 kubectl-1.17.17-0 --disableexcludes=kubernetes
10、重启kubelet
systemctl restart kubelet
11、升级其他控制节点 31 32节点
kubeadm upgrade node experimental-control-plane
12、升级worker节点 33 34 35 36 50
yum install -y kubeadm-1.17.17-0 --disableexcludes=kubernetes
13、腾空当前工作节点
kubectl drain 172.16.100.33 --ignore-daemonsets
14、升级worker节点kubelet配置
kubeadm upgrade node config --kubelet-version v1.17.17-0
15、升级kubelet与kubectl
yum install -y kubelet-1.17.17-0 kubectl-1.17.17-0 --disableexcludes=kubernetes
16、重启worker节点kubelet 并取消保护
systemctl restart kubelet
kubectl uncordon 172.16.100.33
17、验证集群状态
kubectl get nodes