Skip to content
Kubernetes day 2 · Chapter 8 of 20 Day 6: Upgrade to v1.36 – the control plane

Day 6: Upgrade to v1.36 – the control plane

Goal: Upgrade all three control plane nodes from v1.35.10 to v1.36.6 under load without losing a single request to shop, and measure the API gaps · Duration: approx. 75 min · Prerequisite: Day 5 (approval granted)

Briefing

  • The order according to the version skew policy: first all API servers, then the kubelets. Today the control plane, tomorrow the kubelets.
  • The first node gets kubeadm upgrade apply, the others kubeadm upgrade node. kubeadm upgrades CoreDNS and kube-proxy only with the last control plane node.
  • Two measurements run alongside: last against shop (the workload) and a probe against /readyz of the virtual address (the API). These are two different things, and today you see why.
  cp1: apply ──▶ cp2: upgrade node ──▶ cp3: upgrade node (+ CoreDNS, kube-proxy)
  kubelets bleiben auf v1.35.10 (erlaubt, Tag 1) ──▶ Tag 7

Drill 1: Start the measurements

A new measurement run for the workload:

mkdir -p ~/day2/tag06 && cd ~/day2/tag06
kubectl -n demo delete pod last
sed "s#http://web.demo#http://shop.demo#" ~/day2/tag00/last.yaml | kubectl apply -f -
kubectl -n demo wait --for=condition=Ready pod/last

The API probe runs in the background on cp3: one call to /readyz per second through the virtual address. /readyz is reachable without authentication.

# on cp3
mkdir -p ~/day2/tag06
nohup sh -c 'while true; do echo "$(date +%T) $(curl -sk -m 2 -o /dev/null \
  -w %{http_code} https://172.16.0.100:6443/readyz)"; sleep 1; done' \
  > ~/day2/tag06/api.log 2>&1 &
tail -2 ~/day2/tag06/api.log

Expected:

20:23:43 200
20:23:44 200

Who holds the virtual address right now?

kubectl -n kube-system get lease plndr-cp-lock -o jsonpath='{.spec.holderIdentity}{"\n"}'

Expected:

cp1

Save your progress? Sign up for free

Drill 2: Package repository and kubeadm to v1.36

On the first node, here cp1. The package repository points to one minor version (Day 1), so change it:

sudo sed -i "s#/v1.35/#/v1.36/#g" /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key \
  | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo apt-get update
apt-cache madison kubeadm | head -2
sudo apt-mark unhold kubeadm
sudo apt-get install -y kubeadm=1.36.6-1.1
sudo apt-mark hold kubeadm
kubeadm version -o short

Expected (abridged):

   kubeadm | 1.36.6-1.1 | https://pkgs.k8s.io/core:/stable:/v1.36/deb  Packages
   kubeadm | 1.36.5-1.1 | https://pkgs.k8s.io/core:/stable:/v1.36/deb  Packages
Canceled hold on kubeadm.
kubeadm set on hold.
v1.36.6

Only kubeadm. kubelet and kubectl deliberately stay on v1.35; they come tomorrow.

Save your progress? Sign up for free

Drill 3: Now the plan shows something

sudo kubeadm upgrade plan | sed -n '/Cluster version/,/kubeadm upgrade apply/p'

Expected (abridged):

[upgrade/versions] Cluster version: 1.35.10
[upgrade/versions] kubeadm version: v1.36.6
[upgrade/versions] Target version: v1.36.6
Components that must be upgraded manually after you have upgraded the control plane
with 'kubeadm upgrade apply':
COMPONENT   NODE      CURRENT    TARGET
kubelet     cp1       v1.35.10   v1.36.6
kubelet     cp2       v1.35.10   v1.36.6
kubelet     cp3       v1.35.10   v1.36.6
Upgrade to the latest stable version:
COMPONENT                 NODE      CURRENT    TARGET
kube-apiserver            cp1       v1.35.10   v1.36.6
...
kube-proxy                          1.35.10    v1.36.6
CoreDNS                             v1.13.1    v1.14.2
etcd                      cp1       3.6.6-0    3.6.8-0
etcd                      cp2       3.6.6-0    3.6.8-0
etcd                      cp3       3.6.6-0    3.6.8-0
You can now apply the upgrade by executing the following command:
    kubeadm upgrade apply v1.36.6

This is the difference from Day 1 and Day 5: only kubeadm v1.36 knows that CoreDNS v1.14.2 and etcd 3.6.8 belong to v1.36. Below the table, kubeadm also checks the configuration formats of kube-proxy and kubelet. If the MANUAL UPGRADE REQUIRED column shows a yes, you stop here.

Save your progress? Sign up for free

Drill 4: The first node – and a gap in the API

sudo kubeadm upgrade apply v1.36.6 --yes | tee apply-cp1.txt

Expected (heavily abridged, 230 seconds in the lab):

[upgrade/preflight] Running preflight checks
[upgrade/preflight] You have chosen to upgrade the cluster version to "v1.36.6"
[upgrade/preflight] Pulling images required for setting up a Kubernetes cluster
[upgrade/staticpods] Preparing for "etcd" upgrade
[upgrade/staticpods] Renewing etcd-server certificate
...
[upgrade/staticpods] Component "etcd" upgraded successfully!
...
[upgrade/staticpods] Component "kube-scheduler" upgraded successfully!
[upgrade/control-plane] The control plane instance for this node was successfully upgraded!
...
[upgrade/addon] Skipping upgrade of addons because control plane instances [cp2 cp3] have
not been upgraded
[upgrade] SUCCESS! A control plane node of your cluster was upgraded to "v1.36.6".

kubeadm replaces the static Pod manifests one after another (etcd, API server, controller manager, scheduler), waits each time until the kubelet has started the new version, and renews the certificates along the way. It skips the add-ons as long as old API servers are still running. And kubectl version right after that?

kubectl version | tail -1

Expected (on some calls):

Server Version: v1.35.10

The request landed on cp2 or cp3, which are still on v1.35. This mixed state is exactly what the skew policy allows. Now the measurements:

kubectl -n demo logs last | wc -l
kubectl -n demo logs last | awk '$2 != 200' | wc -l
# on cp3
awk '$2 != 200' ~/day2/tag06/api.log

Expected:

1305
0
20:25:03 000
20:25:06 000
20:25:09 000
20:25:12 000
20:25:15 000
20:25:18 000
20:25:22 000

shop: 0 errors in 1,305 requests. Workloads notice nothing of a control plane upgrade; their Pods keep running on the kubelets. The API, however, was unreachable for about 20 seconds. Cause: In ARP mode, kube-vip sends all traffic to the leader, here cp1. When kubeadm replaced the API server on cp1, the virtual address pointed to a server that did not exist at that moment. The other two API servers were running but received nothing.

Save your progress? Sign up for free

Drill 5: cp2 – a gap nobody expects

cp2 is not the leader, so the API should stay undisturbed here.

# on cp2
sudo sed -i "s#/v1.35/#/v1.36/#g" /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key \
  | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo apt-get update
sudo apt-mark unhold kubeadm
sudo apt-get install -y kubeadm=1.36.6-1.1
sudo apt-mark hold kubeadm
sudo kubeadm upgrade node

Expected (abridged, 183 seconds in the lab):

[upgrade/kubelet-config] The kubelet configuration for this node was successfully
upgraded!
[upgrade/addon] Skipping upgrade of addons because control plane instances [cp3] have
not been upgraded

shop stays at 0 errors. The API probe still shows a gap:

# on cp3
awk '$1 >= "20:29:35" && $2 != 200' ~/day2/tag06/api.log

Expected:

20:30:08 000
20:30:11 000
20:30:14 000
20:30:17 000
20:30:20 000
kubectl -n kube-system get lease plndr-cp-lock -o jsonpath='{.spec.holderIdentity}{"\n"}'
kubectl -n kube-system logs kube-vip-cp1 | grep -i leader | tail -2

Expected (abridged):

cp3
2026/11/21 20:30:22 INFO New leader leader=cp3

While etcd was being replaced on cp2, kube-vip on cp1 did not renew its lease in time and lost the leadership. cp3 took over, and it took about 15 seconds until the virtual address had moved in the network. The most likely explanation: the renewal goes through the local API server, and that server answered too slowly during the member change in etcd. Only the result is certain: Any disturbance in the control plane can move the virtual address, and every move costs seconds.

Save your progress? Sign up for free

Drill 6: cp3 – hand over the leadership first, then upgrade

Now cp3 is the leader and next in line. The lesson from Drill 4: the leader must not be the node whose API server is about to restart. So cp3 hands over the leadership in an orderly way beforehand. To do this, you take kube-vip out of the static Pods, the kubelet stops it, and kube-vip releases its lease on shutdown.

Warning: Never take kube-vip out on the last node where it is still running. Without kube-vip there is no virtual address and therefore no API.

# on cp3
sudo mv /etc/kubernetes/manifests/kube-vip.yaml /etc/kubernetes/kube-vip.yaml.pausiert
sleep 30
ip -br -4 addr show eth0
awk '$1 >= "20:33:33"' ~/day2/tag06/api.log | awk '{print $2}' | sort | uniq -c

Expected:

eth0             UP             172.16.0.83/24 metric 100
     28 200

cp3 has given up the address, and not a single probe failed. An orderly handover costs nothing; only a forced one does. The new leader:

kubectl -n kube-system get lease plndr-cp-lock -o jsonpath='{.spec.holderIdentity}{"\n"}'

Expected:

cp1

Now the upgrade of cp3, the last control plane node:

# on cp3
sudo sed -i "s#/v1.35/#/v1.36/#g" /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key \
  | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo apt-get update
sudo apt-mark unhold kubeadm
sudo apt-get install -y kubeadm=1.36.6-1.1
sudo apt-mark hold kubeadm
sudo kubeadm upgrade node

Expected (abridged, 205 seconds in the lab):

[upgrade/control-plane] The control plane instance for this node was successfully upgraded!
...
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

As the last node, cp3 also upgrades CoreDNS and kube-proxy. Then put kube-vip back:

# on cp3
sudo mv /etc/kubernetes/kube-vip.yaml.pausiert /etc/kubernetes/manifests/kube-vip.yaml
awk '$1 >= "20:34:51"' ~/day2/tag06/api.log | awk '{print $2}' | sort | uniq -c

Expected:

    189 200

And the workload, across the entire upgrade:

kubectl -n demo logs last | wc -l
kubectl -n demo logs last | awk '$2 != 200' | wc -l

Expected:

3747
0

Save your progress? Sign up for free

Drill 7: The final state

kubectl -n kube-system get pods -l tier=control-plane \
  -o custom-columns=POD:.metadata.name,IMAGE:.spec.containers[0].image \
  --sort-by=.metadata.name | grep cp1
kubectl -n kube-system get deploy coredns \
  -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
kubectl get nodes

Expected:

etcd-cp1                      registry.k8s.io/etcd:3.6.8-0
kube-apiserver-cp1            registry.k8s.io/kube-apiserver:v1.36.6
kube-controller-manager-cp1   registry.k8s.io/kube-controller-manager:v1.36.6
kube-scheduler-cp1            registry.k8s.io/kube-scheduler:v1.36.6
registry.k8s.io/coredns/coredns:v1.14.2
NAME   STATUS   ROLES           AGE   VERSION
cp1    Ready    control-plane   94m   v1.35.10
cp2    Ready    control-plane   92m   v1.35.10
cp3    Ready    control-plane   91m   v1.35.10

The control plane is on v1.36.6, the nodes still show v1.35.10. That is the version of the kubelet, and you upgrade it tomorrow. The PDB for CoreDNS from Day 3 has survived the upgrade:

kubectl get pdb -A

Expected:

NAMESPACE     NAME      MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
demo          shop      1               N/A               1                     39m
kube-system   coredns   N/A             1                 1                     36m

The results of the day:

Node Workload shop API through the virtual address
cp1 (leader, apply) 0 errors 7 errors, approx. 20 s
cp2 (not leader) 0 errors 5 errors, approx. 15 s (unplanned leader change)
cp3 (leadership handed over first) 0 errors 0 errors

Save your progress? Sign up for free

Exercise: Speed Drills

  1. Show where kubeadm backed up the old manifests and the etcd data. Target time: 1 min
  2. Check when the control plane certificates expire now. Target time: 1 min
  3. Show the etcd version of all three members in a table. Target time: 2 min

Solution

sudo ls /etc/kubernetes/tmp/
kubeadm-backup-etcd-2026-11-21-20-25-00
kubeadm-backup-manifests-2026-11-21-20-25-00
kubeadm-kubelet-config-2026-11-21-20-28-17

Before the upgrade, kubeadm backed up the etcd data directory and the old manifests. This is its own way back for an aborted run, not a replacement for your snapshot from Day 5.

sudo kubeadm certs check-expiration | sed -n '/CERTIFICATE/,/^$/p' | cut -c1-70 | head -5
CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE
admin.conf                 Nov 21, 2027 20:24 UTC   364d            ca
apiserver                  Nov 21, 2027 20:24 UTC   364d            ca
apiserver-etcd-client      Nov 21, 2027 20:24 UTC   364d            etcd-ca
apiserver-kubelet-client   Nov 21, 2027 20:24 UTC   364d            ca

The expiry time is the time of the upgrade plus one year. If you upgrade at least once a year, you never have to renew certificates by hand. On Day 10 you see what happens when you do have to.

sudo etcdctl --endpoints=https://172.16.0.126:2379,https://172.16.0.228:2379,\
https://172.16.0.83:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt \
  --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key \
  endpoint status -w table | cut -d'|' -f2,4,10 | grep -v '^+'
         ENDPOINT          | VERSION | IS LEADER
 https://172.16.0.126:2379 |   3.6.8 |      true
 https://172.16.0.228:2379 |   3.6.8 |     false
  https://172.16.0.83:2379 |   3.6.8 |     false

Save your progress? Sign up for free

Checkpoint

kubectl version

Expected:

Client Version: v1.35.10
Kustomize Version: v5.7.1
Server Version: v1.36.6
kubectl -n kube-system get pods -o wide | grep kube-vip | cut -c1-60

Expected: three kube-vip-… Pods in status Running, one each on cp1, cp2, cp3.

kubectl -n demo logs last | awk '$2 != 200' | wc -l

Expected: 0.

Challenge

Write down the order in which you perform the next control plane upgrade without any API gap. Keep in mind that any node could be the leader at some point.

Hint: Any node can hand over the leadership, but never two at the same time.

Solution

For each control plane node, one after another:

  1. Does this node hold the lease? Then take out the kube-vip manifest, wait 30 seconds, and check that another node has the address.
  2. Upgrade kubeadm, then kubeadm upgrade apply (first node) or kubeadm upgrade node.
  3. Put the kube-vip manifest back; kube-vip-<node> must be Running.
  4. Only then the next node.

This protects against the case from Drill 4. It does not fully protect against the case from Drill 5, an unplanned leader change. Only a load balancer that distributes across all API servers eliminates that (Enterprise Note). On Day 9 you apply this order.

Save your progress? Sign up for free

Cleanup

Stop the API probe on cp3. Keep the log for the comparison with Day 9.

# on cp3
pkill -f readyz
cp ~/day2/tag06/api.log ~/day2/tag06/api-v1.36.log

Interview Note

  • What is the difference between kubeadm upgrade apply and upgrade node? apply runs once, on the first node, and raises the cluster version. node brings the remaining control plane nodes and all workers up to date.
  • Why do workloads notice nothing of a control plane upgrade? Because running Pods depend on the kubelet and the runtime, not on the API server. Without the API nothing new happens, but what exists keeps running.
  • When does kubeadm upgrade CoreDNS and kube-proxy? With the last control plane node, when no old API server is running anymore.

Enterprise Note

  • In production, a load balancer usually sits in front of the API servers (HAProxy with keepalived, F5, cloud LB) and serves all healthy API servers based on a health check. A single restart then costs nothing at all.
  • kube-vip also offers a load balancer mode that distributes traffic across all control plane nodes instead of sending everything to the leader.
  • Control plane upgrades often run in their own maintenance window, the kubelets afterwards in waves over several days, which the skew policy explicitly allows.

Contents

More