Cluster operationsLesson 5 of 16
Upgrading a cluster with kubeadm (CKA)
This relates to "Manage the lifecycle of Kubernetes clusters (upgrades)" in the CKA Cluster Architecture, Installation and Configuration (25%) domain. We upgrade a 1.36 cluster built with kubeadm (the official Kubernetes install tool) to 1.37, and follow which commands run on each node, in what order.
Why the control plane goes first, and how drain respects PDBs, are covered in Draining Nodes and Upgrading the Cluster. Here we focus on the order of kubeadm commands.
Control plane1.36
worker-1 kubelet1.36
Command just runkubectl get nodes
RequestResponse / reportAppears in a later step
What you will learn
- The rule: upgrade one minor version at a time
- What upgrade plan and upgrade apply do
- Why the kubelet must be upgraded separately after apply
- Workers use upgrade node instead of apply
Common exam questions
| Situation | What to do / command | Trap |
|---|---|---|
| Upgrade the control plane by one version | Switch repo address → install kubeadm → kubeadm upgrade plan → kubeadm upgrade apply v1.37.x | You cannot skip minor versions. With the old repo address, the new packages do not show up |
| Second control plane node | kubeadm upgrade node | upgrade apply runs only once, on the first node |
| apply finished but the node version did not change | Install kubelet and kubectl → systemctl daemon-reload → systemctl restart kubelet | VERSION in kubectl get nodes is the kubelet version |
| Upgrade a worker node | Install kubeadm → kubeadm upgrade node → kubectl drain <node> --ignore-daemonsets → install and restart kubelet → kubectl uncordon <node> | Do not run upgrade apply on a worker. Run drain where kubectl is available, and install packages on the node itself |
| The job is done | kubectl uncordon, then check Ready and VERSION with kubectl get nodes | Forget uncordon and the node stays SchedulingDisabled |
Try it yourself
kubectl get nodes # VERSION = kubelet version per node
apt-cache madison kubeadm # Versions in the current repository
kubeadm version # kubeadm upgraded first?
sudo kubeadm upgrade plan # Component versions; changes nothing
sudo kubeadm certs check-expiration # Certificates renewed by apply
kubelet --version # This node's kubelet
Check yourself
Further reading: CNCF certification curriculum · Upgrading kubeadm clusters · Version skew policy · Draining Nodes and Upgrading the Cluster