CKA : Upgrading kubeadm clusters

Prathap
2 min readOct 8, 2021
  1. Upgrade a primary control plane node.
  2. Upgrade additional control plane nodes.
  3. Upgrade worker nodes.

Upgrade a primary control plane node

Step 1: Upgrade kubeadm

> apt-get update && apt-get install -y — allow-change-held-packages kubeadm=1.22.x-00 where x is the required version

Check the download works and has the expected version using kubeadm version

Verify the upgrade plan using kubeadm upgrade plan. This command checks that your cluster can be upgraded, and fetches the versions you can upgrade to

Choose a version to upgrade to, and run the appropriate command,

# replace x with the patch version you picked for this upgrade
sudo kubeadm upgrade apply v1.22.x

Manually upgrade your CNI provider plugin

This step is not required on additional control plane nodes if the CNI provider runs as a DaemonSet.

For the other control plane nodes

Same as the first control plane node but use:

sudo kubeadm upgrade node

instead of:

sudo kubeadm upgrade apply

Also calling kubeadm upgrade plan and upgrading the CNI provider plugin is no longer needed.

Step 2: Drain the node

Prepare the node for maintenance by marking it unschedulable and evicting the workloads:

# replace <node-to-drain> with the name of your node you are draining kubectl drain <node-to-drain> --ignore-daemonsets

Step 3: Upgrade kubelet and kubectl

# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.22.x-00 kubectl=1.22.x-00

Restart the kubelet:

sudo systemctl daemon-reload

sudo systemctl restart kubelet

Step 4: Uncordon the node

Bring the node back online by marking it schedulable:

# replace <node-to-drain> with the name of your node kubectl uncordon <node-to-drain>

--

--