CKA — Cluster Upgrades Lab
Lab Overview
Perform a complete cluster upgrade from Kubernetes v1.29 to v1.30 on a cluster with one control plane and two worker nodes.
Task 1: Verify Current State
kubectl get nodes
# All nodes should show v1.29.0
Task 2: Upgrade the Control Plane
# Upgrade kubeadm
sudo apt-mark unhold kubeadm
sudo apt-get update && sudo apt-get install -y kubeadm=1.30.0-1.1
sudo apt-mark hold kubeadm
# Plan and apply
sudo kubeadm upgrade plan
sudo kubeadm upgrade apply v1.30.0
# Drain control plane
kubectl drain controlplane --ignore-daemonsets --delete-emptydir-data
# Upgrade kubelet and kubectl
sudo apt-mark unhold kubelet kubectl
sudo apt-get install -y kubelet=1.30.0-1.1 kubectl=1.30.0-1.1
sudo apt-mark hold kubelet kubectl
sudo systemctl daemon-reload
sudo systemctl restart kubelet
# Uncordon
kubectl uncordon controlplane
Task 3: Upgrade Worker01
# From control plane: drain the worker
kubectl drain worker01 --ignore-daemonsets --delete-emptydir-data
# SSH to worker01
ssh worker01
# Upgrade kubeadm
sudo apt-mark unhold kubeadm
sudo apt-get update && sudo apt-get install -y kubeadm=1.30.0-1.1
sudo apt-mark hold kubeadm
# Upgrade node config
sudo kubeadm upgrade node
# Upgrade kubelet and kubectl
sudo apt-mark unhold kubelet kubectl
sudo apt-get install -y kubelet=1.30.0-1.1 kubectl=1.30.0-1.1
sudo apt-mark hold kubelet kubectl
sudo systemctl daemon-reload
sudo systemctl restart kubelet
# Exit back to control plane
exit
# Uncordon worker01
kubectl uncordon worker01
Task 4: Upgrade Worker02
Follow the same steps as Task 3 for worker02.
Task 5: Final Verification
kubectl get nodes
# All nodes should show v1.30.0
kubectl get pods -n kube-system
# All system pods Running
Practice Questions
Q1: What is the correct order for upgrading a Kubernetes cluster?
Show Answer
- Upgrade kubeadm on the control plane
- Run
kubeadm upgrade planandkubeadm upgrade apply - Upgrade kubelet and kubectl on the control plane
- Drain each worker node one at a time
- Upgrade kubeadm, run
kubeadm upgrade node, upgrade kubelet/kubectl on worker - Uncordon the worker node
Always upgrade the control plane first, then workers. Never skip minor versions.
Q2: Can you upgrade directly from Kubernetes v1.28 to v1.30?
Show Answer
No. Kubernetes only supports upgrading one minor version at a time. You must upgrade v1.28 -> v1.29, then v1.29 -> v1.30.
Q3: What is the difference between kubectl cordon and kubectl drain?
Show Answer
kubectl cordon— Marks node as unschedulable. Existing Pods keep running.kubectl drain— Marks node as unschedulable AND evicts all Pods (except DaemonSets).
During upgrades, always use drain to safely remove workloads before upgrading.
Q4: After kubeadm upgrade apply, nodes still show the old version. Why?
Show Answer
kubeadm upgrade apply upgrades control plane components but does not upgrade kubelet. The version shown by kubectl get nodes comes from the kubelet.
You must separately upgrade kubelet:
sudo apt-get install -y kubelet=1.30.0-1.1
sudo systemctl daemon-reload
sudo systemctl restart kubelet
Q5: A drain fails with “cannot evict pod” due to a PodDisruptionBudget. How do you proceed?
Show Answer
Options:
- Scale up the Deployment so more replicas are available
- Check the PDB:
kubectl get pdb -A— see if minAvailable allows eviction - Wait for other replicas to become ready
- Delete the PDB temporarily if safe (last resort)
In the exam, check the PDB first and ensure enough replicas are running.