References
For example, Upgrade 1.21.00
to 1.21.1
Upgrade All Kubernetes Components on the Control Node
-
Download kubeadm version
sudo apt-get update && \ sudo apt-get install -y --allow-change-held-packages kubeadm=1.21.1-00
-
Drain the control plane node:
kubectl drain acgk8s-control --ignore-daemonsets
-
Check whether the components are upgradeable to
v1.21.1
:sudo kubeadm upgrade plan v1.21.1
-
Apply the upgrade:
sudo kubeadm upgrade apply v1.21.1
-
Upgrade
kubelet
andkubectl
:sudo apt-get update && \ sudo apt-get install -y --allow-change-held-packages kubelet=1.21.1-00 kubectl=1.21.1-00
-
Reload daemons
sudo systemctl daemon-reload
-
Restart
kubelet
:sudo systemctl restart kubelet
-
Uncordon the control plane node:
kubectl uncordon acgk8s-control
Upgrade All Kubernetes Components on the Worker Node
-
Drain the worker1 node:
kubectl drain acgk8s-worker1 --ignore-daemonsets --force
-
SSH into the Worker node:
ssh acgk8s-worker1
-
Install a new version of kubeadm:
sudo apt-get update && \ sudo apt-get install -y --allow-change-held-packages kubeadm=1.21.1-00
-
Upgrade the node:
sudo kubeadm upgrade node
-
Upgrade kubelet and kubectl:
sudo apt-get update && \ sudo apt-get install -y --allow-change-held-packages kubelet=1.21.1-00 kubectl=1.21.1-00
-
Reload daemon
sudo systemctl daemon-reload
-
Restart kubelet:
sudo systemctl restart kubelet
-
Type
exit
to exit the node. -
Uncordon the node:
kubectl uncordon acgk8s-worker1
-
Repeat the process above for other worker nodes