Skip to main content
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
Control plane nodeWorker node · worker-1Operatorssh · kubectlpkgs.k8s.iopackage repokubeadmupgrade toolkubeletnode managerComponentsAPI, etcd, etc.1.36kubeadmupgrade toolkubeletnode manager1.36App podsworker-1to 1.37
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​

SituationWhat to do / commandTrap
Upgrade the control plane by one versionSwitch repo address → install kubeadm → kubeadm upgrade plan → kubeadm upgrade apply v1.37.xYou cannot skip minor versions. With the old repo address, the new packages do not show up
Second control plane nodekubeadm upgrade nodeupgrade apply runs only once, on the first node
apply finished but the node version did not changeInstall kubelet and kubectl → systemctl daemon-reload → systemctl restart kubeletVERSION in kubectl get nodes is the kubelet version
Upgrade a worker nodeInstall 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 donekubectl uncordon, then check Ready and VERSION with kubectl get nodesForget 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

  1. kubeadm upgrade apply v1.37.x succeeded, but kubectl get nodes still shows the control plane node at 1.36. Why?
  2. You are upgrading worker-1 to 1.37. Which kubeadm command do you run on it?
  3. On the control plane node, apt shows no 1.37 kubeadm package. What did you skip?

Further reading: CNCF certification curriculum · Upgrading kubeadm clusters · Version skew policy · Draining Nodes and Upgrading the Cluster