By the end you'll know
- How to back up etcd, and find every flag the backup needs in etcd's own file
- The order a kubeadm upgrade must follow, and why the control plane goes first
- What
kubeadm upgrade planandapplydo, and what they leave to you - How to drain a node safely and bring it back
- How to restore etcd from a snapshot, and prove it worked
- Why you never restore a pre-upgrade snapshot into an upgraded cluster
Before you start
- You need: the cluster from Lesson 2, all nodes
Readyon v1.36. This lesson changes it for real, to v1.37. - Internet access on the machines: they download packages and etcd's tools.
- The output below is from real runs on November 26, 2026, in New York, on an Apple silicon Mac. Times in the output are in UTC.
This is the lesson Lesson 1 promised: the cluster started one version behind the exam on purpose, and now you upgrade it. Upgrades and etcd backups are both named in the Cluster Architecture domain, 25% of the score, and both take many steps in a strict order. Practicing them end to end once is worth a lot.
The plan:
- Back up etcd, so there's a way back.
- Upgrade the control plane node: kubeadm, then the control plane, then its kubelet.
- Upgrade each worker, one at a time, after draining it.
- Restore etcd from a snapshot, to prove backups work.
Step 1: back up etcd
etcd holds the cluster's entire state: every pod, Deployment, Service, Secret and ConfigMap. Back it up before anything risky.
(cp1)
k -n kube-system get pod etcd-cp1 -o jsonpath='{.spec.containers[0].image}'; echo
which etcdctl etcdutl
registry.k8s.io/etcd:3.6.8-0
- The image tag tells you etcd's version: 3.6.8. The backup tools should match it.
whichprinted nothing: kubeadm runs etcd in a container and doesn't install its tools on the machine. Check before installing them: on a prepared machine they may be there already.
Install etcdctl and etcdutl
From etcd's official release, checking the download against its published checksums:
ETCD_VER=v3.6.8
ARCH=$(dpkg --print-architecture)
cd /tmp
curl -fsSLO https://github.com/etcd-io/etcd/releases/download/${ETCD_VER}/etcd-${ETCD_VER}-linux-${ARCH}.tar.gz
curl -fsSLO https://github.com/etcd-io/etcd/releases/download/${ETCD_VER}/SHA256SUMS
grep "linux-${ARCH}.tar.gz" SHA256SUMS | sha256sum -c -
dpkg --print-architecture: your machine type,arm64here.curl -fsSLO:-ffails on errors instead of saving an error page,-sis silent,-Sstill shows errors,-Lfollows redirects,-Okeeps the file's own name.sha256sum -c -: checks the download against the line fromSHA256SUMS.
etcd-v3.6.8-linux-arm64.tar.gz: OK
tar -xzf etcd-${ETCD_VER}-linux-${ARCH}.tar.gz
sudo install etcd-${ETCD_VER}-linux-${ARCH}/etcdctl etcd-${ETCD_VER}-linux-${ARCH}/etcdutl /usr/local/bin/
etcdctl version
cd ~
etcdctl version: 3.6.8
API version: 3.6
Two tools, two jobs: etcdctl talks to a running etcd, for example to take a snapshot. etcdutl works on files directly, to check or restore one. Since etcd 3.6, restoring is etcdutl's job.
Find the flags in etcd's own file
Every etcd command needs four values: where etcd listens, and the certificates that prove you may talk to it. They're all in its static pod file:
sudo grep -E "cert-file|key-file|trusted-ca-file|listen-client-urls" /etc/kubernetes/manifests/etcd.yaml
- --cert-file=/etc/kubernetes/pki/etcd/server.crt
- --key-file=/etc/kubernetes/pki/etcd/server.key
- --listen-client-urls=https://127.0.0.1:2379,https://192.168.34.154:2379
- --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
- --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
- --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
- --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
| etcdctl flag | From | Here |
|---|---|---|
--endpoints | --listen-client-urls | https://127.0.0.1:2379 (the client port) |
--cacert | --trusted-ca-file | /etc/kubernetes/pki/etcd/ca.crt |
--cert | --cert-file | /etc/kubernetes/pki/etcd/server.crt |
--key | --key-file | /etc/kubernetes/pki/etcd/server.key |
Ignore the peer- lines: they're for etcd members talking to each other. On the exam, read these from the file rather than from memory. A task's cluster may keep its certificates somewhere else.
Take the snapshot
sudo etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /opt/etcd-before-upgrade.db
sudo etcdutl --write-out=table snapshot status /opt/etcd-before-upgrade.db
sudo: only root can read the key file.snapshot save: copies etcd's whole database into one file.snapshot status: checks the file.--write-out=tableformats the result.
{"level":"info",...,"msg":"created temporary db file","path":"/opt/etcd-before-upgrade.db.part"}
...
{"level":"info",...,"msg":"fetched snapshot","endpoint":"https://127.0.0.1:2379","size":"5.3 MB","took":"36.923477ms","etcd-version":"3.6.0"}
Snapshot saved at /opt/etcd-before-upgrade.db
Server version 3.6.0
+----------+----------+------------+------------+---------+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE | VERSION |
+----------+----------+------------+------------+---------+
| 296cd293 | 124269 | 658 | 5.3 MB | 3.6.0 |
+----------+----------+------------+------------+---------+
- 658 keys: every object in the cluster.
.part: etcdctl writes to a temporary file and renames it only when the snapshot is complete, so a half-finished backup never looks like a real one.3.6.0is etcd's data format version, set by the minor release, not the 3.6.8 program version.
Step 2: upgrade the control plane
kubeadm upgrades one minor version at a time, always in this order: kubeadm itself, then the control plane, then the kubelets.
Point the package source at the new version
Each Kubernetes minor version has its own package repository at pkgs.k8s.io:
sudo sed -i 's#/v1.36/#/v1.37/#' /etc/apt/sources.list.d/kubernetes.list
cat /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update -qq
apt-cache madison kubeadm | head -3
apt-cache madison: lists the versions available, newest first.
deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.37/deb/ /
kubeadm | 1.37.3-1.1 | https://pkgs.k8s.io/core:/stable:/v1.37/deb Packages
kubeadm | 1.37.2-1.1 | https://pkgs.k8s.io/core:/stable:/v1.37/deb Packages
kubeadm | 1.37.1-1.1 | https://pkgs.k8s.io/core:/stable:/v1.37/deb Packages
Upgrade kubeadm
node-setup.sh held the Kubernetes packages, so ordinary updates couldn't change them. Unhold, upgrade, hold again:
sudo apt-mark unhold kubeadm
sudo apt-get install -y kubeadm='1.37.*'
sudo apt-mark hold kubeadm
kubeadm version -o short
'1.37.*': the newest v1.37 patch. The quotes stop the shell from treating*as a file pattern.
Selected version '1.37.3-1.1' (isv:kubernetes:core:stable:v1.37:pkgs.k8s.io [arm64]) for 'kubeadm'
...
Unpacking kubeadm (1.37.3-1.1) over (1.36.6-1.1) ...
kubeadm set on hold.
v1.37.3
Plan first
sudo kubeadm upgrade plan
It changes nothing; it only reports. The parts that matter:
[upgrade/versions] Cluster version: 1.36.6
[upgrade/versions] kubeadm version: v1.37.3
[upgrade/versions] Target version: v1.37.3
[upgrade/versions] Latest version in the v1.36 series: v1.36.7
...
Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT NODE CURRENT TARGET
kubelet cp1 v1.36.6 v1.37.3
kubelet worker1 v1.36.6 v1.37.3
kubelet worker2 v1.36.6 v1.37.3
Upgrade to the latest stable version:
COMPONENT NODE CURRENT TARGET
kube-apiserver cp1 v1.36.6 v1.37.3
kube-controller-manager cp1 v1.36.6 v1.37.3
kube-scheduler cp1 v1.36.6 v1.37.3
kube-proxy 1.36.6 v1.37.3
CoreDNS v1.14.2 v1.14.6
etcd cp1 3.6.8-0 3.7.0-0
You can now apply the upgrade by executing the following command:
kubeadm upgrade apply v1.37.3
- Two routes are offered:
v1.36.7, the newest patch of the current minor version, andv1.37.3, the next minor version. The exam runs v1.37, so that's the target. - The kubelets "must be upgraded manually": the kubelet is a systemd service installed by apt, not a pod, so kubeadm can't replace it.
- etcd moves to 3.7. That's why the backup came first.
Apply it
sudo kubeadm upgrade apply v1.37.3
It asks Are you sure you want to proceed? [y/N]; type y. (-y skips the question.) It takes a few minutes:
[upgrade/staticpods] Preparing for "etcd" upgrade
[upgrade/staticpods] Renewing etcd-server certificate
[upgrade/staticpods] Moving new manifest to "/etc/kubernetes/manifests/etcd.yaml" and backing up old manifest to "/etc/kubernetes/tmp/kubeadm-backup-manifests-2026-11-26-06-55-26/etcd.yaml"
[upgrade/staticpods] Waiting for the kubelet to restart the component
E1126 06:55:57.084023 10199 request.go:1198] "Unexpected error when reading response body" err="net/http: request canceled (Client.Timeout or context cancellation while reading body)"
[upgrade/staticpods] Component "etcd" upgraded successfully!
[upgrade/staticpods] Preparing for "kube-apiserver" upgrade
[upgrade/staticpods] Renewing apiserver certificate
...
[upgrade/staticpods] Component "kube-apiserver" upgraded successfully!
...
[upgrade/staticpods] Component "kube-controller-manager" upgraded successfully!
...
[upgrade/staticpods] Component "kube-scheduler" upgraded successfully!
...
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy
[upgrade] SUCCESS! A control plane node of your cluster was upgraded to "v1.37.3".
- One part at a time: etcd, the API server, the controller manager, the scheduler, each replaced and checked before the next.
Renewing ... certificate: an upgrade renews the control plane's certificates as a side effect. They last a year, so a cluster upgraded at least yearly never has them expire.backing up old manifest to /etc/kubernetes/tmp/...: the previous static pod files, kept in case an upgrade fails partway.- The one
E1126 ... request canceledline came from the moment etcd restarted. kubeadm retried and moved on.
Upgrade cp1's kubelet
Move the workloads off the node, upgrade, put it back:
k drain cp1 --ignore-daemonsets
sudo apt-mark unhold kubelet kubectl
sudo apt-get install -y kubelet='1.37.3-*' kubectl='1.37.3-*'
sudo apt-mark hold kubelet kubectl
sudo systemctl daemon-reload
sudo systemctl restart kubelet
k uncordon cp1
k get nodes
drain: marks the node unschedulable (it cordons it) and evicts its pods, so their controllers recreate them elsewhere.--ignore-daemonsets: leaves DaemonSet pods alone. They belong on every node, and drain refuses without this flag.'1.37.3-*': pins the exact patch the control plane runs.daemon-reload, thenrestart: the package's unit files may have changed (Lesson 3's ticket 5), then the new kubelet starts.uncordon: makes the node schedulable again.
NAME STATUS ROLES AGE VERSION
cp1 Ready control-plane 2d3h v1.37.3
worker1 Ready <none> 2d2h v1.36.6
worker2 Ready <none> 2d2h v1.36.6
This mix is allowed. A kubelet may be up to three minor versions older than the API server, but never newer. That's why the control plane always goes first.
Step 3: upgrade the workers
One worker at a time, so the other keeps the apps running.
(worker1)
sudo sed -i 's#/v1.36/#/v1.37/#' /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update -qq
sudo apt-mark unhold kubeadm
sudo apt-get install -y kubeadm='1.37.3-*'
sudo apt-mark hold kubeadm
sudo kubeadm upgrade node
[upgrade/preflight] Skipping prepull. Not a control plane node.
[upgrade/control-plane] Skipping phase. Not a control plane node.
[upgrade/kubeconfig] Skipping phase. Not a control plane node.
[upgrade] Backing up kubelet config file to /etc/kubernetes/tmp/kubeadm-kubelet-config-2026-11-26-07-02-54/config.yaml
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[upgrade/kubelet-config] The kubelet configuration for this node was successfully upgraded!
On a worker, kubeadm upgrade node does one thing: it rewrites the kubelet's configuration from the cluster. Everything else is skipped.
(cp1)
k drain worker1 --ignore-daemonsets --delete-emptydir-data
--delete-emptydir-data: allows evicting pods with anemptyDirvolume, scratch space deleted with the pod. metrics-server uses one, and drain refuses without the flag.
node/worker1 cordoned
Warning: ignoring DaemonSet-managed Pods: kube-system/calico-node-m8qnn, kube-system/kube-proxy-6xg9m
evicting pod t9/shop-7fdbcc6c6f-hbg7n
evicting pod default/web-558f679c7b-55jmr
...
evicting pod kube-system/coredns-559f6c778d-fpbnr
...
pod/coredns-559f6c778d-fpbnr evicted
node/worker1 drained
It cordoned the node first, so nothing new could land there, skipped the two DaemonSet pods, and evicted the other 10. Their controllers recreated them on worker2.
(worker1)
sudo apt-mark unhold kubelet kubectl
sudo apt-get install -y kubelet='1.37.3-*' kubectl='1.37.3-*'
sudo apt-mark hold kubelet kubectl
sudo systemctl daemon-reload
sudo systemctl restart kubelet
(cp1) k uncordon worker1. Then worker2, the same way. Its drain moved 17 pods to worker1, metrics-server and calico-kube-controllers among them. Afterwards:
vagrant@cp1:~$ k get nodes
NAME STATUS ROLES AGE VERSION
cp1 Ready control-plane 2d3h v1.37.3
worker1 Ready <none> 2d3h v1.37.3
worker2 Ready <none> 2d2h v1.37.3
vagrant@cp1:~$ k get pods -A -o wide | grep -v Running
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
grep -v Runninghides every Running pod. Only the header came back: everything survived the moves.
Step 4: restore etcd from a snapshot
Not the pre-upgrade snapshot
/opt/etcd-before-upgrade.db was the way back if the upgrade had failed. Restoring it now would roll the cluster's data back underneath newer components. Keep it as an emergency copy, and practice restores with a fresh snapshot instead.
etcd is on 3.7.0 now, so install the matching tools, the same way as before, with ETCD_VER=v3.7.0:
etcd-v3.7.0-linux-arm64.tar.gz: OK
etcdctl version: 3.7.0
API version: 3.7
Make something to lose
k create ns restore-test
k create configmap proof -n restore-test --from-literal=taken=before-snapshot
--from-literal=key=value: a ConfigMap with one key, straight from the command line. This is the proof object.
Take a snapshot with the same etcdctl command, saved to /opt/etcd-snapshot.db:
+---------+----------+------------+------------+---------+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE | VERSION |
+---------+----------+------------+------------+---------+
| 67d3e16 | 127220 | 1016 | 8.1 MB | 3.7.0 |
+---------+----------+------------+------------+---------+
1,016 keys now: the upgrade and all the moves added objects. Then delete the proof, as if by mistake:
vagrant@cp1:~$ k delete ns restore-test
namespace "restore-test" deleted
vagrant@cp1:~$ k get ns restore-test
Error from server (NotFound): namespaces "restore-test" not found
Restore into a new folder
sudo etcdutl snapshot restore /opt/etcd-snapshot.db --data-dir /var/lib/etcd-restored
--data-dir /var/lib/etcd-restored: a new folder. The current data in/var/lib/etcdstays untouched as a fallback.
info snapshot/v3_snapshot.go:306 restoring snapshot {"path": "/opt/etcd-snapshot.db", "wal-dir": "/var/lib/etcd-restored/member/wal", "data-dir": "/var/lib/etcd-restored", "snap-dir": "/var/lib/etcd-restored/member/snap", ...}
...
info schema/membership.go:125 Trimming membership information from the backend...
info membership/cluster.go:408 added member {"cluster-id": "cdf818194e3a8c32", "local-member-id": "0", "added-peer-id": "8e9e05c52164694d", "added-peer-peer-urls": ["http://localhost:2380"], "added-peer-is-learner": false}
...
info snapshot/v3_snapshot.go:334 restored snapshot {...}
snapandwal: the database itself, and the write-ahead log (WAL) where etcd records each change before applying it.Trimming membershipandadded member: a restore always creates a new one-member cluster. On a multi-node etcd you'd pass--nameand--initial-cluster; a single node is fine with the default.
Point etcd at the restored folder
etcd's static pod reads its data from a hostPath volume. Look before changing:
vagrant@cp1:~$ sudo grep -n "/var/lib/etcd" /etc/kubernetes/manifests/etcd.yaml
18: - --data-dir=/var/lib/etcd
75: - mountPath: /var/lib/etcd
91: path: /var/lib/etcd
Only line 91 is on the machine. Lines 18 and 75 are inside the container, and they stay the same: the container keeps using /var/lib/etcd, which is now backed by the restored folder.
sudo sed -i 's#path: /var/lib/etcd$#path: /var/lib/etcd-restored#' /etc/kubernetes/manifests/etcd.yaml
$matches only a line that ends in/var/lib/etcd, and lowercasepath:skipsmountPath:.
91: path: /var/lib/etcd-restored
The kubelet sees the changed file and restarts etcd, and the API server restarts with it. For a minute, kubectl can't answer:
Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get namespaces restore-test)
A few seconds later:
vagrant@cp1:~$ k get ns restore-test
NAME STATUS AGE
restore-test Active 5m
vagrant@cp1:~$ k get cm proof -n restore-test -o jsonpath='{.data.taken}'; echo
before-snapshot
It's back, and it's five minutes old. A restore doesn't recreate objects, it puts back the data exactly as it was, creation time included. etcd's own logs show it starting as that new one-member cluster:
... "msg":"8e9e05c52164694d became leader at term 2"}
... "msg":"ready to serve client requests"}
... "msg":"serving client traffic securely","traffic":"grpc+http","address":"127.0.0.1:2379"}
And the cost: everything created after the snapshot is gone. On a real cluster, a restore rolls back every change since the backup.
How the drills work
Each drill is a task to do from a blank terminal. Try it first, without looking. Then open "Show the fast way" to compare your commands, and read the notes under them: they cover the part people usually get wrong. Repeat a drill a few days later until you can do it cold, because the exam leaves little time to look things up.
The drills
Save an etcd snapshot to /opt/etcd-backup.db, and check that it's valid.
Show the fast way
sudo grep -E "cert-file|key-file|trusted-ca-file|listen-client-urls" /etc/kubernetes/manifests/etcd.yaml
sudo etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /opt/etcd-backup.db
sudo etcdutl --write-out=table snapshot status /opt/etcd-backup.db
Read the four values from etcd.yaml, not from memory: the task's cluster may differ. Use the client port, 2379, never the peer port. Without sudo, etcdctl can't read the key file. A status table with a key count is your proof the file is valid.
Restore etcd from /opt/etcd-backup.db and make the cluster use the restored data.
Show the fast way
sudo etcdutl snapshot restore /opt/etcd-backup.db --data-dir /var/lib/etcd-restored
sudo grep -n "/var/lib/etcd" /etc/kubernetes/manifests/etcd.yaml
sudo sed -i 's#path: /var/lib/etcd$#path: /var/lib/etcd-restored#' /etc/kubernetes/manifests/etcd.yaml
sudo crictl ps -a --name etcd # wait for the new one to run
k get ns # retry until the API server answers
Restore into a new folder, then change only the hostPath path: in etcd.yaml. The --data-dir flag and the mountPath are inside the container and stay the same. Expect a minute of timeouts while etcd and the API server restart.
Upgrade the control plane node to the next minor version, then one worker.
Show the fast way
# control plane
sudo sed -i 's#/v1.36/#/v1.37/#' /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update -qq
sudo apt-mark unhold kubeadm && sudo apt-get install -y kubeadm='1.37.3-*' && sudo apt-mark hold kubeadm
sudo kubeadm upgrade plan
sudo kubeadm upgrade apply v1.37.3
k drain cp1 --ignore-daemonsets
sudo apt-mark unhold kubelet kubectl && sudo apt-get install -y kubelet='1.37.3-*' kubectl='1.37.3-*' && sudo apt-mark hold kubelet kubectl
sudo systemctl daemon-reload && sudo systemctl restart kubelet
k uncordon cp1
# worker: same repo switch and kubeadm upgrade, then
sudo kubeadm upgrade node
# drain from the control plane, kubelet and kubectl on the worker, uncordon from the control plane
kubeadm, then the control plane, then the kubelets, and the control plane node before any worker. apply on the control plane, upgrade node on workers. Drain before the kubelet upgrade, uncordon after. If a task names a version, use exactly that one.
On exam day
- Read the task's version exactly, including the patch. "Upgrade to 1.37.3" means
kubeadm upgrade apply v1.37.3, not the newest available. - Copy the upgrade steps from the docs ("Upgrading kubeadm clusters"). They list every command in order.
- Watch where you are. Repo changes and package upgrades run on the node being upgraded.
drainanduncordonrun where kubectl works. - Write the snapshot to exactly the path the task names, and check it with
snapshot status. - After a restore, wait. A timeout for the first minute is normal.
Clean up
(cp1)
k delete ns restore-test t6 t7 t8 t9 t10
Keep /opt/etcd-before-upgrade.db and /opt/etcd-snapshot.db, and the old /var/lib/etcd folder, until you're sure you don't need them. Then exit and vagrant halt, as usual.
In real life
- Back up etcd on a schedule, not just before upgrades, and copy the snapshots off the machine. A backup on the node it protects is lost with the node.
- Snapshots contain every Secret in the cluster. Encrypt and protect them like the secrets they are.
- Managed services upgrade the control plane for you. On Amazon EKS (Elastic Kubernetes Service), Azure AKS or Google GKE, you click or run one command, then roll the nodes. The order, control plane first, is the same.
- Upgrade often, one minor version at a time. Each version is supported for about a year, and skipping versions isn't allowed with kubeadm.
Spot the problem
Work out what's wrong before you read the explanation.
"I'll go straight to the newest version." A cluster runs v1.35, and someone runs kubeadm upgrade apply v1.37.3. kubeadm refuses. Why? kubeadm upgrades one minor version at a time. Upgrade to v1.36 first, all nodes included, then to v1.37.
"The restore didn't take." After etcdutl snapshot restore --data-dir /var/lib/etcd-restored, someone changes --data-dir= in etcd.yaml to /var/lib/etcd-restored. etcd starts with an empty database. What went wrong? They changed the path inside the container, not the hostPath on the machine. The container's /var/lib/etcd-restored is an empty folder, because no volume is mounted there. Change the hostPath path: instead, or change all three lines together.
"Upgraded, but the node still says the old version." After kubeadm upgrade apply succeeds, k get nodes shows the control plane node on the old version. Did the upgrade fail? No: the VERSION column is the kubelet's version, and apply doesn't touch the kubelet. Upgrade the kubelet package and restart it.
Keep this
| To | Use |
|---|---|
| Find etcd's version | k -n kube-system get pod etcd-NODE -o jsonpath='{.spec.containers[0].image}' |
| Find etcdctl's four flags | sudo grep -E "cert-file|key-file|trusted-ca-file|listen-client-urls" /etc/kubernetes/manifests/etcd.yaml |
| Snapshot etcd | sudo etcdctl --endpoints=... --cacert=... --cert=... --key=... snapshot save FILE |
| Check a snapshot | sudo etcdutl --write-out=table snapshot status FILE |
| Restore a snapshot | sudo etcdutl snapshot restore FILE --data-dir NEW-DIR, then the hostPath in etcd.yaml |
| Switch package version | sed the version in /etc/apt/sources.list.d/kubernetes.list, then apt-get update |
| See what an upgrade will do | sudo kubeadm upgrade plan |
| Upgrade the control plane | sudo kubeadm upgrade apply vX.Y.Z |
| Upgrade a worker's config | sudo kubeadm upgrade node |
| Move pods off a node | k drain NODE --ignore-daemonsets --delete-emptydir-data |
| Let pods back on | k uncordon NODE |
Where you are now
Your cluster runs v1.37.3, the exam's version, and you did it the way the kubeadm docs lay out: an etcd backup first, plan before apply, the control plane before the workers, and a drain before every kubelet upgrade. You've also restored etcd from a snapshot and watched a deleted namespace come back. Lesson 6 moves to access control: RBAC, and proving exactly who can do what.
Check yourself
kubeadm upgrade plan lists the kubelets under Components that must be upgraded manually. Why can't kubeadm upgrade them?
You need an etcd snapshot. Which value goes in etcdctl's --cert flag?
The control plane is on v1.37 and a worker is still on v1.36. Is the cluster in a supported state?
k drain worker1 refuses to continue and names a pod using an emptyDir volume. What do you add?
After etcdutl snapshot restore --data-dir /var/lib/etcd-restored, which line in etcd.yaml do you change?
Right after switching etcd to the restored data, kubectl fails with Error from server (Timeout). What's the best next step?
Key terms
- etcd snapshot: a single file holding a copy of etcd's whole database.
- etcdctl / etcdutl: etcd's tools. etcdctl talks to a running etcd; etcdutl works on data files, including restores.
- kubeadm upgrade plan / apply: plan reports what an upgrade would do; apply upgrades the control plane.
- kubeadm upgrade node: updates a worker's kubelet configuration during an upgrade.
- Drain: cordon a node and evict its pods, so it can be worked on.
- Cordon / uncordon: mark a node unschedulable, or schedulable again.
- Version skew: how far apart component versions may be. kubelets may lag the API server by up to three minor versions.
- Package hold:
apt-mark hold, which stops ordinary updates from changing a package. - WAL (write-ahead log): the log where etcd records each change before applying it.
Go deeper
- Upgrading kubeadm clusters (opens in a new tab), the page to copy upgrade steps from.
- Operating etcd clusters for Kubernetes (opens in a new tab), including backing up and restoring.
- Version skew policy (opens in a new tab), for which versions may run together.
- Safely drain a node (opens in a new tab).