CKA Control-Plane node Update

Hello guys, I can’t update the control-plane node I’m running the following commands

1- apt update
apt-cache madison kubeadm

2 - apt-mark unhold kubeadm &&
apt-get update && apt-get install -y kubeadm=1.24.0-00 &&
apt-mark hold kubeadm

3 - kubeadm upgrade plan

4 - sudo kubeadm upgrade apply v1.24.0

5 - kubectl drain controlplane --ignore-daemonsets

6 - apt-mark unhold kubelet kubectl &&
apt-get update && apt-get install -y kubelet=1.24.0-00 kubectl=1.24.0-00 &&
apt-mark hold kubelet kubectl

7 - sudo systemctl daemon-reload

8 - sudo systemctl restart kubelet

When I reload the daemon and the kubelet, I can’t see any change in the controlplane node.

It appears:

NAME STATUS ROLES AGE VERSION
controlplane NotReady,SchedulingDisabled control-plane 4h33m v1.23.0
node01 Ready 4h33m v1.23.0

It still remains in the v1.23.0 after the kubelet restarts.

I’m running these commands in the KodeKloud playground, more specifically:

https://kodekloud.com/topic/playground-k8s-1-23-multi-node-weave/

cheers guys, hope you all gave a great week.

1 Like

Hi @luizandrends

There is a slight issue with the order of your commands, but that’s not the whole story.
The commands should go in this order

apt update -y
apt-mark unhold kubeadm kubelet kubectl
apt install -y kubeadm=1.24.0-00
kubectl drain controlplane --ignore-daemonsets 
kubeadm upgrade plan v1.24.0
kubeadm upgrade apply v1.24.0
apt install -y kubelet=1.24.0-00 kubectl=1.24.0-00
apt-mark hold kubeadm kubelet kubectl
kubectl uncordon controlplane
systemctl daemon-reload
systemctl restart kubelet

The actual reason why you get that status from get nodes is that the kubelet has crashed. I have a few ideas why that might be and will raise it internally. Watch this space!

1 Like

Hi @luizandrends

The issue is that we have to make some manual changes to kubelet configuration after upgrading it due to retirement of dockershim . Kubeadm does not upgrade any kubelet configuration.

This is what worked for me.
After installing the new kubelet, you need to do the following

Edit /var/lib/kubelet/kubeadm-flags.env

Replace "--network-plugin=cni
with --container-runtime-endpoint unix:///run/containerd/containerd.sock

Then run the following, as we will get a different error otherwise (reference)

rm /etc/containerd/config.toml
systemctl restart containerd

Then boot kubelet

systemctl daemon-reload
systemctl restart kubelet

You’ll need to do that on every node where kubelet is upgraded.