如何升级 Kubernetes 集群 v1.19.4 到 1.19.13

How to upgrade Kubernetes cluster v1.19.4 to 1.19.13

我正在尝试通过以下步骤在 Ubuntu 系统上将我们的 Kubernetes kubeadm clusterv-1.19.4 升级到 v-1.19.13,我可以升级我的主控主机,但是工作主机仍然使用相同的旧版本。

On Master:-
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.19.13-00 && \
apt-mark hold kubeadm

apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.19.13-00

kubeadm upgrade plan

kubeadm upgrade apply v1.19.13

kubeadm upgrade node

kubectl drain worker-1 --ignore-daemonsets
kubectl drain worker-2 --ignore-daemonsets

apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.19.13-00 kubectl=1.19.13-00 && \
apt-mark hold kubelet kubectl

apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.19.13-00 kubectl=1.19.13-00 

systemctl daemon-reload
systemctl restart kubelet

kubectl uncordon worker-1
kubectl uncordon worker-2

On Worker Host:-

apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.19.13-00 && \
apt-mark hold kubeadm

apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.19.13-00

kubeadm upgrade node

On Master Host:-
kubectl drain worker-1 --ignore-daemonsets
kubectl drain worker-2 --ignore-daemonsets

On Worker Node:-
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.19.13-00 kubectl=1.19.13-00 && \
apt-mark hold kubelet kubectl

apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.19.13-00 kubectl=1.19.13-00

systemctl daemon-reload
systemctl restart kubelet

On Master Host:-
kubectl uncordon worker-1
kubectl uncordon worker-2

~# kubectl get nodes
NAME      STATUS   ROLES      AGE   VERSION
master    Ready    master     45h   v1.19.13
worker1   Ready    worker-1   27h   v1.19.4
worker2   Ready    worker-2   27h   v1.19.4

这里我的工作节点仍然有旧 v1.19.4。我需要在工作主机上执行任何其他步骤吗?请建议。谢谢。

重启所有主机并尝试上述步骤,升级成功。