CookbookStudy and examsNo. 13
Kubernetes certification notesdomain by domain, with typed-command drills
See it in know.sh
CKACluster architecture, installation and configuration
8of 14
Drain and upgrade a worker node with kubeadm
Observation, key section, 1 highlight, 2 sources, 320 words
The task. Upgrade worker-2 on the practice cluster from 1.34 to 1.35, after the control plane. One minor version at a time, and never a kubelet newer than the API server. Steps 1 to 3 and 5 run on worker-2 over ssh; steps 4 and 6 run where kubectl has the admin kubeconfig.
Upgrade worker-2, in this order
Point apt at the 1.35 packages (worker-2)
The package repository is per minor version. Then list what it offers and note the newest 1.35 patch.
sudo sed -i 's|/v1.34/|/v1.35/|' /etc/apt/sources.list.d/kubernetes.list sudo apt-get update apt-cache madison kubeadmUpgrade kubeadm (worker-2)
The version is the one
madisonlisted; 1.35.1-1.1 in this lab.sudo apt-mark unhold kubeadm && sudo apt-get install -y kubeadm='1.35.1-1.1' && sudo apt-mark hold kubeadmUpgrade the node’s configuration (worker-2)
On a worker this upgrades the local kubelet configuration.
sudo kubeadm upgrade nodeDrain the node (control plane)
Cordons it, then evicts its pods. Without the flag, drain stops at the DaemonSet pods.
kubectl drain worker-2 --ignore-daemonsetsUpgrade the kubelet and kubectl, then restart (worker-2)
Hold the packages again so a routine
apt-get upgradecannot move them.sudo apt-mark unhold kubelet kubectl && sudo apt-get install -y kubelet='1.35.1-1.1' kubectl='1.35.1-1.1' && sudo apt-mark hold kubelet kubectl sudo systemctl daemon-reload sudo systemctl restart kubeletBring it back (control plane)
worker-2 should show Ready and v1.35.1.
kubectl uncordon worker-2 kubectl get nodes
Upgrade worker-2, in this order
- Point apt at the 1.35 packages (worker-2)
The package repository is per minor version. Then list what it offers and note the newest 1.35 patch.
sudo sed -i 's|/v1.34/|/v1.35/|' /etc/apt/sources.list.d/kubernetes.list sudo apt-get update apt-cache madison kubeadm - Upgrade kubeadm (worker-2)
The version is the one
madisonlisted; 1.35.1-1.1 in this lab.sudo apt-mark unhold kubeadm && sudo apt-get install -y kubeadm='1.35.1-1.1' && sudo apt-mark hold kubeadm - Upgrade the node’s configuration (worker-2)
On a worker this upgrades the local kubelet configuration.
sudo kubeadm upgrade node - Drain the node (control plane)
Cordons it, then evicts its pods. Without the flag, drain stops at the DaemonSet pods.
kubectl drain worker-2 --ignore-daemonsets - Upgrade the kubelet and kubectl, then restart (worker-2)
Hold the packages again so a routine
apt-get upgradecannot move them.sudo apt-mark unhold kubelet kubectl && sudo apt-get install -y kubelet='1.35.1-1.1' kubectl='1.35.1-1.1' && sudo apt-mark hold kubelet kubectl sudo systemctl daemon-reload sudo systemctl restart kubelet - Bring it back (control plane)
worker-2 should show Ready and v1.35.1.
kubectl uncordon worker-2 kubectl get nodes
```element steps
{
"label": "Upgrade worker-2, in this order",
"steps": [
{
"title": "Point apt at the 1.35 packages (worker-2)",
"body": "The package repository is per minor version. Then list what it offers and note the newest 1.35 patch.",
"code": "sudo sed -i 's|/v1.34/|/v1.35/|' /etc/apt/sources.list.d/kubernetes.list\nsudo apt-get update\napt-cache madison kubeadm"
},
{
"title": "Upgrade kubeadm (worker-2)",
"body": "The version is the one `madison` listed; 1.35.1-1.1 in this lab.",
"code": "sudo apt-mark unhold kubeadm && sudo apt-get install -y kubeadm='1.35.1-1.1' && sudo apt-mark hold kubeadm"
},
{
"title": "Upgrade the node’s configuration (worker-2)",
"body": "On a worker this upgrades the local kubelet configuration.",
"code": "sudo kubeadm upgrade node"
},
{
"title": "Drain the node (control plane)",
"body": "Cordons it, then evicts its pods. Without the flag, drain stops at the DaemonSet pods.",
"code": "kubectl drain worker-2 --ignore-daemonsets"
},
{
"title": "Upgrade the kubelet and kubectl, then restart (worker-2)",
"body": "Hold the packages again so a routine `apt-get upgrade` cannot move them.",
"code": "sudo apt-mark unhold kubelet kubectl && sudo apt-get install -y kubelet='1.35.1-1.1' kubectl='1.35.1-1.1' && sudo apt-mark hold kubelet kubectl\nsudo systemctl daemon-reload\nsudo systemctl restart kubelet"
},
{
"title": "Bring it back (control plane)",
"body": "*worker-2* should show *Ready* and v1.35.1.",
"code": "kubectl uncordon worker-2\nkubectl get nodes"
}
]
}
```What went wrong. The first time I skipped step 1, so madison listed only 1.34 packages and step 2 failed with “Version ‘1.35.1-1.1’ for ‘kubeadm’ was not found”. The repository change is easy to forget because nothing warns you.
Sources. Upgrading kubeadm clusters; Changing the Kubernetes package repository (both kubernetes.io).
QuizzesCluster architecture, installation and configurationQuestion 5 of 8
Type the command that marks node worker-2 unschedulable and evicts its pods, ignoring pods managed by DaemonSets.
Your answerkubectl drain worker-2 --ignore-daemonsets
Right. drain cordons the node first, then evicts; without --ignore-daemonsets it refuses to go on while DaemonSet pods are on the node. Afterwards, kubectl uncordon worker-2 puts it back. See Cluster architecture, installation and configuration, 8.
How it works
The CKA hands you a terminal and a clock, so you need the flags, the paths and the order of steps cold. Claude Code files your lab notes as a section per task, a worker upgrade becomes six steps that say which machine each runs on, and typed-answer quizzes make you write every command character for character.