CKA Exam Prep Node Version Not Upgraded — Common Confusion Kubeadm Upgrade
2 min readNov 9, 2024
The step is to upgrade : FIRST controlpane THEN worker node
- Go to Controlplane
- Drain Controlplane (Auto cordon)
- ** Upgrade
kubeadm
** - ** Upgrade
kubelet
,kubectl
Restart Service ** - Uncordon the controlplane
- Drain Node (Auto cordon)
- Go to Node
- ** Upgrade
kubeadm
** - ** Upgrade
kubelet
,kubectl
Restart Service** - Bring back the Node
Each Node — There are 2 things to upgrade : FIRST kubeadm THEN kubelet, kubectl
See the version by
sudo apt update
sudo apt-cache madison kubeadm
If you do not find the version you want to upgrade to, see note below.
First with kubeadm
sudo apt-get update
sudo apt-get install -y kubeadm='1.31.0-1.1' && \
Then for: kubectl and kubelet
Here is the confusion happen, the command look the same, so you skip this step
sudo apt-get update
sudo apt-get install -y kubelet='1.31.x-*' kubectl='1.31.0-1.1'
With Additional Restart
sudo systemctl daemon-reload
sudo systemctl restart kubelet
Note: Make SURE apt is actually upgrading
After run this command you might experience warning
You see the log and though the package is upgraded. See carefully what the log say.
Some common mistake
You either need
--allow-change-held-packages
sudo apt-get update
sudo apt-get install -y kubeadm='1.31.0-1.1' --allow-change-held-packages
Or the unhold
as the doc suggest
sudo apt-mark unhold kubeadm
sudo apt-get update
sudo apt-get install -y kubeadm='1.31.0-1.1'
sudo apt-mark hold kubeadm
Sometimes you make mistake to upgrade to too latest.
You need the downgradable flag to make it do what you want.
--allow-downgrades
sudo apt-get update
sudo apt-get install -y kubelet='1.31.0-1.1' kubectl='1.31.0-1.1' --allow-downgrades
Note: Mistake in apt version
nano /etc/apt/sources.list.d/kubernetes.list/
Go there and fix the version if there is nothing matched. Then run the update
again
sudo apt update
sudo apt-cache madison kubeadm
Note: How to check
You MUST go back to controlplane to run
kubectl get node
And see the version is upgraded