Day 16: Competition – the maintenance night
Goal: In five rounds, find and fix faults from everyday operations, against the clock and without a single failed request · Duration: approx. 90 min · Prerequisite: Days 0–15
Briefing
- One maintenance night, five incidents. Each comes from a topic of the book: drain and PDB, kubelet certificates, etcd snapshots, a node after patching, requests and limits.
- The load generator runs through the whole night.
Scoring counts not only the time, but also whether the log shows
0errors at the end. - Tools: everything from the book.
kubectl,etcdctl,systemctl,journalctl, SSH to the nodes.
Round Symptom Target time
1 Maintenance on cp2: drain does not get through 4 min
2 kubectl logs fails for Pods on cp3 4 min
3 Monitoring: no more etcd snapshots on cp2 5 min
4 cp3 NotReady after a change 5 min
5 New setting for shop does not arrive 4 min
Rules of the Game
- In each round, the referee runs their commands, a colleague or you yourself without looking: copy the block, paste it into a second terminal, close the window. Then start the clock.
- Find the cause, fix it, prove it with the measurement. Only then stop the clock.
- Fix the cause, not the symptom: if you delete a PDB, the LimitRange
or the timer instead of correcting it, or clear a Pod out of the way
with
--force, you get zero points. - Read the hint only after the target time has run out.
- Pod names, CSR names and hashes will differ on your side.
Playing Field
Once before the first round, on cp1:
mkdir -p ~/day2/tag16 && cd ~/day2/tag16
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
kubectl get nodes
kubectl -n demo get deploy,pdbExpected:
NAME STATUS ROLES AGE VERSION
cp1 Ready control-plane 22h v1.37.2
cp2 Ready control-plane 22h v1.37.2
cp3 Ready control-plane 49m v1.37.2
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/shop 2/2 2 2 21h
deployment.apps/web 3/3 3 3 21h
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
poddisruptionbudget.policy/shop 1 N/A 1 21h
poddisruptionbudget.policy/web N/A 1 1 20h
The measurement after each round:
kubectl get nodes --no-headers | awk '{print $1, $2}'
kubectl -n demo get deploy -o custom-columns=NAME:.metadata.name,READY:.status.readyReplicas,\
AKTUELL:.status.updatedReplicas
kubectl -n demo logs last | awk '$2 != 200' | wc -lHealthy means: three nodes Ready without
SchedulingDisabled, READY equal to
AKTUELL (current) (2 for shop, 3 for
web) and 0 errors.
Round 1: Maintenance on cp2
Referee (on cp1):
kubectl -n demo patch pdb shop --type=merge -p '{"spec":{"minAvailable":2}}' >/dev/null
clearTask: cp2 is due for maintenance. Drain it, and put it back into service afterwards. Target time: 4 min
Hint: How many disruptions does the PDB allow right now?
Solution Round 1
kubectl drain cp2 --ignore-daemonsets --delete-emptydir-data --timeout=40s | tail -3Expected:
error: unable to drain node "cp2" due to error: error when evicting pods/"shop-86856b859d-wlcm4" -n "demo": global timeout reached: 40s, continuing command...
There are pending nodes to be drained:
cp2
kubectl -n demo get pdbExpected:
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
shop 2 N/A 0 21h
web N/A 1 0 20h
shop has two Pods and demands two: no disruption
allowed. That web is also at 0 is a consequence of the
drain: its Pod from cp2 has already been evicted, and the replacement
waits for a free node because of the spread rule (Day 15). The cause is
the PDB of shop. Correct it instead of deleting it:
kubectl -n demo patch pdb shop --type=merge -p '{"spec":{"minAvailable":1}}'
kubectl drain cp2 --ignore-daemonsets --delete-emptydir-data --timeout=120s | tail -1
kubectl uncordon cp2Expected:
poddisruptionbudget.policy/shop patched
node/cp2 drained
node/cp2 uncordoned
Spread the Pods again for the measurement:
kubectl -n demo rollout restart deploy/shop deploy/web
kubectl -n demo rollout status deploy/shop --timeout=120s | tail -1
kubectl -n demo rollout status deploy/web --timeout=120s | tail -1
kubectl -n demo logs last | wc -l
kubectl -n demo logs last | awk '$2 != 200' | wc -lExpected:
deployment.apps/shop restarted
deployment.apps/web restarted
deployment "shop" successfully rolled out
deployment "web" successfully rolled out
313
0
Equally valid: scale shop to three replicas. Then
minAvailable: 2 allows one disruption.
Save your progress? Sign up for free
Round 2: No logs from cp3
Referee:
# on cp3
sudo rm -f /var/lib/kubelet/pki/kubelet-server-*
sudo systemctl restart kubelet
clearTask: A colleague reports that
kubectl logs no longer works for Pods on cp3 and that
kubectl top does not know cp3. Fix it. Target
time: 4 min
Hint: Day 10, serverTLSBootstrap.
Solution Round 2
P=$(kubectl -n kube-system get pod -l k8s-app=kube-proxy --field-selector spec.nodeName=cp3 -o name)
kubectl -n kube-system logs $P --tail=1 | cut -c1-120
kubectl top node cp3
kubectl get csr | grep -E 'NAME|Pending'Expected:
Error from server: Get "https://172.16.0.83:10250/containerLogs/kube-system/kube-proxy-46knh/kube-proxy?tailLines=1": remote error: tls: internal error
Error from server (NotFound): nodemetrics.metrics.k8s.io "cp3" not found
NAME AGE SIGNERNAME REQUESTOR REQUESTEDDURATION CONDITION
csr-fwrg8 22s kubernetes.io/kubelet-serving system:node:cp3 <none> Pending
tls: internal error from port 10250: the kubelet has no
serving certificate. It has requested one, but since Day 10 nobody
approves these requests automatically. Check first, then approve:
kubectl get csr csr-fwrg8 -o jsonpath='{.spec.request}' | base64 -d | openssl req -noout -text \
| grep DNS:
kubectl certificate approve csr-fwrg8
kubectl -n kube-system logs $P --tail=1 | cut -c1-60Expected:
DNS:cp3, IP Address:172.16.0.83
certificatesigningrequest.certificates.k8s.io/csr-fwrg8 approved
I1122 17:01:56.357272 1 shared_informer.go:510] "Caches
metrics-server needs one more scrape cycle:
sleep 40
kubectl top node cp3Expected:
NAME CPU(cores) CPU(%) MEMORY(bytes) MEMORY(%)
cp3 504m 25% 1993Mi 52%
Save your progress? Sign up for free
Round 3: No snapshot on cp2
Referee:
# on cp2
sudo sed -i 's#etcd/server.key#etcd/peer.key#' /etc/systemd/system/etcd-snapshot.service
sudo systemctl daemon-reload
sudo systemctl start etcd-snapshot.service 2>/dev/null
clearTask: Monitoring reports that no new etcd snapshot has been created on cp2. Find the cause and create a fresh snapshot. Target time: 5 min
Hint: The timer is not the problem.
Solution Round 3
# on cp2
systemctl is-active etcd-snapshot.timer
systemctl status etcd-snapshot.service --no-pager | sed -n 3p
sudo journalctl -u etcd-snapshot.service --no-pager -n 8 | grep -iE 'error|failed' | head -2 \
| cut -c1-90Expected:
active
Active: failed (Result: exit-code) since Sun 2026-11-22 17:24:36 UTC; 191ms ago
Nov 22 17:24:36 cp2 sh[11392]: Error: tls: private key does not match public key
Nov 22 17:24:36 cp2 systemd[1]: etcd-snapshot.service: Failed with result 'exit-code'.
The timer is active and would keep firing every six
hours, but the service fails every time. This is exactly the trap from
the Day 11 challenge. Key and certificate do not match:
# on cp2
grep ETCDCTL_ /etc/systemd/system/etcd-snapshot.serviceExpected:
Environment=ETCDCTL_ENDPOINTS=https://127.0.0.1:2379
Environment=ETCDCTL_CACERT=/etc/kubernetes/pki/etcd/ca.crt
Environment=ETCDCTL_CERT=/etc/kubernetes/pki/etcd/server.crt
Environment=ETCDCTL_KEY=/etc/kubernetes/pki/etcd/peer.key
# on cp2
sudo sed -i 's#etcd/peer.key#etcd/server.key#' /etc/systemd/system/etcd-snapshot.service
sudo systemctl daemon-reload
sudo systemctl start etcd-snapshot.service
systemctl is-failed etcd-snapshot.service
sudo ls -t /var/backups/k8s/etcd/ | head -1Expected:
inactive
etcd-20261122-1724.db
inactive is good here: a oneshot service
that has finished. A failure would say failed.
Save your progress? Sign up for free
Round 4: cp3 NotReady
Referee:
# on cp3
sudo fallocate -l 1G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile >/dev/null
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab >/dev/null
sudo systemctl restart kubelet
clearTask: After a change by a colleague, cp3 reports
NotReady. Bring it back, permanently. Target
time: 5 min
Hint: Read what the kubelet says on startup.
Solution Round 4
kubectl get nodesExpected (after about 40 seconds):
NAME STATUS ROLES AGE VERSION
cp1 Ready control-plane 22h v1.37.2
cp2 Ready control-plane 22h v1.37.2
cp3 NotReady control-plane 53m v1.37.2
# on cp3
systemctl is-active kubelet
sudo journalctl -u kubelet --no-pager -n 30 | grep -i 'command failed' | tail -1 | cut -c1-200Expected:
activating
Nov 22 17:25:14 cp3 kubelet[3634]: E1122 17:25:14.427255 3634 run.go:72] "command failed" err="failed to run Kubelet: running with swap on is not supported, please disable swap or set --fail-swap-on flag to false"
activating means that systemd keeps restarting the
kubelet, and it exits every time. The kubelet of a healthy node shows
the setting behind it:
kubectl get --raw /api/v1/nodes/cp1/proxy/configz | jq '.kubeletconfig | {failSwapOn, memorySwap}'Expected:
{
"failSwapOn": true,
"memorySwap": {}
}Swap has been officially supported since Kubernetes 1.34, but only if
you explicitly allow it in the kubelet. Here it is not wanted, so remove
it, also from /etc/fstab, or it comes back on the next
reboot:
# on cp3
swapon --show
sudo swapoff /swapfile
sudo sed -i '\#^/swapfile #d' /etc/fstab
sudo rm /swapfile
sudo systemctl restart kubelet
systemctl is-active kubeletExpected:
NAME TYPE SIZE USED PRIO
/swapfile file 1024M 0B -2
active
kubectl get nodes
kubectl -n demo logs last | wc -l
kubectl -n demo logs last | awk '$2 != 200' | wc -lExpected:
NAME STATUS ROLES AGE VERSION
cp1 Ready control-plane 22h v1.37.2
cp2 Ready control-plane 22h v1.37.2
cp3 Ready control-plane 54m v1.37.2
1300
0
The kubelet was gone for almost a minute and a half, and still
0 errors: the containers on cp3 kept running without
the kubelet, as with k3s on Day 14. Only after five minutes of
NotReady would Kubernetes have started moving the Pods to
other nodes.
Save your progress? Sign up for free
Round 5: The new setting
Referee:
kubectl -n demo set resources deploy/shop --limits=memory=1Gi >/dev/null
clearTask: A colleague rolled out a new setting for
shop, but it does not arrive. Find out why, and bring
shop to a clean state. Target time: 4
min
Hint: Day 13.
Solution Round 5
kubectl -n demo rollout status deploy/shop --timeout=30s
kubectl -n demo get deploy shop
kubectl -n demo get deploy shop \
-o jsonpath='{.status.conditions[?(@.type=="ReplicaFailure")].message}{"\n"}'Expected:
Waiting for deployment "shop" rollout to finish: 0 out of 2 new replicas have been updated...
error: timed out waiting for the condition
NAME READY UP-TO-DATE AVAILABLE AGE
shop 2/2 2 2 21h
pods "shop-65b7855c45-m6ggg" is forbidden: maximum memory usage per Container is 512Mi, but limit is 1Gi
READY 2/2 is deceptive: the old Pods keep running, and
the new ReplicaSet does not get a single Pod. The LimitRange allows at
most 512 Mi. According to kubectl top, shop
needs a few megabytes, so the old value was right:
kubectl -n demo set resources deploy/shop --limits=memory=64Mi
kubectl -n demo rollout status deploy/shop --timeout=120s | tail -1
kubectl -n demo get deploy shopExpected:
deployment.apps/shop resource requirements updated
deployment "shop" successfully rolled out
NAME READY UP-TO-DATE AVAILABLE AGE
shop 2/2 2 2 21h
The rollout finishes immediately: the template matches the previous
one again, so Kubernetes uses the existing ReplicaSet. That is also the
path kubectl rollout undo would have taken.
Save your progress? Sign up for free
Scoring
The final measurement:
kubectl get nodes --no-headers | awk '{print $1, $2}'
kubectl -n demo get deploy -o custom-columns=NAME:.metadata.name,READY:.status.readyReplicas,\
AKTUELL:.status.updatedReplicas
kubectl -n demo logs last | wc -l
kubectl -n demo logs last | awk '$2 != 200' | wc -lExpected:
cp1 Ready
cp2 Ready
cp3 Ready
NAME READY AKTUELL
shop 2 2
web 3 3
1508
0
| Points | for |
|---|---|
| 2 | each round fixed within the target time |
| 1 | each round fixed, target time exceeded |
| 0 | round “solved” by deleting or with --force |
| +5 | 0 errors in the load generator over the whole
night |
| Total | Assessment |
|---|---|
| 15 | On-call: you may handle nights on your own |
| 10–14 | Operations-ready: no problem with a runbook |
| below 10 | Repeat the days for the rounds you missed |
Challenge
Write an entry for Round 4 in the runbook from Day 15 that catches the fault during the next patching, before the node reboots.
Hint: What could you have checked before the reboot?
Solution
- [ ] No swap active and none in /etc/fstab: `swapon --show` empty,
`grep -c swap /etc/fstab` = 0 (otherwise the kubelet does not start after the reboot)
swapon --show
grep -c swap /etc/fstabExpected:
0
swapon --show prints nothing when no swap is active.
Save your progress? Sign up for free
Cleanup
Every round ends in a clean state. The cluster is running, and it will stay that way: that is the point of Day 2.
Checkpoint
kubectl -n demo get pdb shop -o jsonpath='{.spec.minAvailable}{"\n"}'Expected: 1
kubectl get csr | grep -c PendingExpected: 0
Interview Note
- A drain hangs. What do you check?
kubectl get pdb -Aand theALLOWED DISRUPTIONScolumn. At 0, correct the PDB or the replica count, do not delete the PDB. kubectl logsfails for one node but works for the others. What is the cause? Usually the kubelet’s serving certificate or the connection to port 10250. WithserverTLSBootstrap, pending CSRs.- A rollout does not arrive, but the Pods are running. How do
you find the cause? In the Deployment’s conditions
(
ReplicaFailure) and the events of the new ReplicaSet: admission, quota or a LimitRange rejects the Pods.
Enterprise Note
- You practice maintenance nights like this one as a game day: planned, with a referee, with measurements and a debrief that produces runbooks and alerts.
- Each round stands for an alert that would be missing in operations:
PDB with 0 allowed disruptions, pending kubelet CSRs, snapshot age,
kubelet restart loops,
ReplicaFailure. All five can be built with kube-state-metrics and Prometheus. - If you beat the target time in every round, you are ready for on-call duty for a self-managed cluster. And hopefully also for making most of these nights unnecessary through automation.