Skip to content

Upgrading a kubeadm cluster one minor version safely — pre-flight, drain order, control plane and worker rolling

A runbook for upgrading a kubeadm-managed Kubernetes cluster by one minor version with zero data-plane downtime — pre-flight, drain order, control-plane rolling, worker rolling, post-checks.

You ran a kubeadm install eighteen months ago and never touched it. The cluster is now two minors behind upstream support, and you only noticed because a CVE advisory mentioned a version older than yours. You schedule the upgrade, read the kubeadm docs once, and reach for kubeadm upgrade apply — and that’s the moment to slow down. A kubeadm minor upgrade is mechanical and routine, but only if you do it in the right order with the right pre-flight checks. The most common production outage in this neighborhood is somebody upgrading kubeadm and kubelet packages in the same apt-get install step, before draining the node, while etcd is still serving — and that node never comes back the same way it left.

What’s happening

A kubeadm minor upgrade (e.g. 1.29 → 1.30) replaces the control-plane components on every CP node in a rolling pattern, then the kubelet on each node one at a time. Kubernetes supports skew between the apiserver and the kubelets — kubelet can lag the apiserver by one minor but never lead it, and you can only skip one minor at a time. So 1.29 → 1.30 is supported; 1.29 → 1.31 is not (you must stop at 1.30 first). Etcd is upgraded as part of the control-plane upgrade — kubeadm pins the etcd image to a known-good version per minor, so etcd moves with the rest of the CP.

The work happens in four phases:

  1. Pre-flight. Verify cluster health, backup etcd, check the channel package repo, read the upstream changelog for breaking flags, audit deprecated APIs.
  2. Control-plane upgrade. On the first CP, run kubeadm upgrade plan then kubeadm upgrade apply v1.30.x. On the remaining CPs, run kubeadm upgrade node. Then upgrade kubelet and kubectl packages on each CP one at a time, with a drain step.
  3. Worker upgrade. On each worker, kubeadm upgrade node (which only handles the kubelet config), then apt-get/dnf upgrade kubelet/kubectl, then systemctl restart kubelet. Drain → upgrade → uncordon, one worker at a time.
  4. Post-checks. Verify all nodes Ready and on the new version, all workloads healthy, etcd snapshot retained, dashboards aware of the new version.

What this runbook is not: it is not an upgrade across multiple minors (do them one at a time), not an upgrade of the OS (do that separately), not a migration to a new CNI (don’t combine), and not an upgrade of the underlying VM hardware. Keep the variables to one at a time.

How to verify

Pre-flight, on any control-plane node:

# Cluster health
kubectl get nodes -o wide
kubectl get cs                  # cs is deprecated but still informative
kubectl -n kube-system get pods -o wide | grep -E 'etcd|kube-apiserver|kube-controller-manager|kube-scheduler'

# etcd health and disk pressure
ETCDCTL_API=3 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 \
  endpoint status --cluster --write-out=table

# Confirm the target version is published in the package repo
# AlmaLinux:
dnf list available --showduplicates kubeadm | grep 1.30
# Ubuntu:
apt-cache madison kubeadm | grep 1.30

# kubeadm pre-flight
kubeadm upgrade plan
# Look for the line:
#   COMPONENT   CURRENT       TARGET
#   kubelet     3 x v1.29.x   v1.30.x
#   kube-apiserver  v1.29.x   v1.30.x

# Deprecated-API audit — what currently-deployed manifests will break in 1.30?
kubectl api-resources --verbs=list -o name | xargs -n1 kubectl get -A -o yaml 2>/dev/null | \
  grep -E 'apiVersion: (extensions|apps/v1beta|batch/v1beta|networking.k8s.io/v1beta|policy/v1beta)' | \
  sort -u

Take a fresh etcd snapshot and verify it. Do not rely on yesterday’s:

ETCDCTL_API=3 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 /var/backups/etcd-pre-upgrade-$(date +%F).db

ETCDCTL_API=3 etcdctl --write-out=table snapshot status \
  /var/backups/etcd-pre-upgrade-$(date +%F).db

# Copy off the node — a snapshot on the same disk as etcd is one disk away from useless.
rsync -a /var/backups/etcd-pre-upgrade-*.db backup-host:/srv/etcd-snapshots/

After the upgrade, the same checks should pass with the new version reported.

The fix

The runbook below assumes 1.29.x → 1.30.x. Replace TARGET=v1.30.4 with whatever patch you’ve selected (don’t pick the freshest patch on day one — wait a few weeks unless you have a security driver). Run sequentially. If anything fails in the middle, stop — do not skip ahead.

#!/usr/bin/env bash
set -euo pipefail

### kubeadm minor-version upgrade runbook (1.29 -> 1.30)
### Run BY HAND, step by step. Do not just execute this top to bottom.

TARGET="v1.30.4"
PKG_TARGET="1.30.4-150500.1.1"   # AlmaLinux/SUSE-style pkg version
DEB_TARGET="1.30.4-1.1"          # Ubuntu deb-style pkg version
K8S_MINOR="v1.30"                # repo channel

cat <<EOF
==========
PRE-FLIGHT (run from one CP node, then read the output carefully)
==========
EOF
kubectl get nodes -o wide
kubectl -n kube-system get pods | grep -E 'etcd|kube-' | sort
kubeadm upgrade plan
echo
echo "STOP. Read the plan output. Continue only when:"
echo "  - all CPs and workers are Ready"
echo "  - no etcd alarms"
echo "  - target version is the one above"
echo "  - the audit step found no deprecated-API objects in production namespaces"
echo "  - you have an etcd snapshot copied off-node, not just on-node"

Phase 1 — first control plane

On cp-1 (the node you ran kubeadm init on):

# AlmaLinux / RHEL-family
dnf install -y --disableexcludes=kubernetes kubeadm-${PKG_TARGET}
kubeadm version    # confirm vTARGET

# Drain cp-1 — workloads (if any) move off; static control-plane pods stay
kubectl drain cp-1 --ignore-daemonsets --delete-emptydir-data

# Apply upgrade on the first CP
kubeadm upgrade apply ${TARGET} --yes

# Watch the CP pods rotate to the new version
kubectl -n kube-system get pods -o wide | grep cp-1

# Upgrade kubelet + kubectl on this node
dnf install -y --disableexcludes=kubernetes \
  kubelet-${PKG_TARGET} kubectl-${PKG_TARGET}
systemctl daemon-reload
systemctl restart kubelet

# Uncordon
kubectl uncordon cp-1

# Verify
kubectl get nodes -o wide
# cp-1 should report v1.30.x and STATUS=Ready

Equivalent on Ubuntu:

apt-get update
apt-mark unhold kubeadm kubelet kubectl
apt-get install -y kubeadm=${DEB_TARGET}
apt-mark hold kubeadm

kubectl drain cp-1 --ignore-daemonsets --delete-emptydir-data
kubeadm upgrade apply ${TARGET} --yes

apt-get install -y kubelet=${DEB_TARGET} kubectl=${DEB_TARGET}
apt-mark hold kubelet kubectl
systemctl daemon-reload
systemctl restart kubelet
kubectl uncordon cp-1

Pause five minutes. Tail kubectl -n kube-system logs -f deploy/kube-controller-manager (or etcd-cp-1) for unexpected errors. The new kube-controller-manager and kube-scheduler talk to etcd through the new apiserver — anything weird here shows up immediately.

Phase 2 — remaining control planes (cp-2, cp-3)

One at a time. Wait until the previous node is back in Ready before starting the next.

# On cp-2
dnf install -y --disableexcludes=kubernetes kubeadm-${PKG_TARGET}

kubectl drain cp-2 --ignore-daemonsets --delete-emptydir-data

# Only `upgrade node` on additional CPs (NOT `upgrade apply`)
kubeadm upgrade node

dnf install -y --disableexcludes=kubernetes \
  kubelet-${PKG_TARGET} kubectl-${PKG_TARGET}
systemctl daemon-reload
systemctl restart kubelet
kubectl uncordon cp-2

Repeat verbatim on cp-3.

After all three CPs:

kubectl get nodes -o wide
# cp-1, cp-2, cp-3 all on v1.30.x and Ready
kubectl -n kube-system get pods | grep etcd
# All three etcd pods should report Ready 1/1 and the same image tag

Phase 3 — workers

For each worker wk-N:

# From a CP, drain the worker (PDBs honored; if a workload PDB is unsatisfiable,
# fix it first — do not --force without understanding why).
kubectl drain wk-1 --ignore-daemonsets --delete-emptydir-data

# Then on wk-1 itself:
dnf install -y --disableexcludes=kubernetes kubeadm-${PKG_TARGET}
kubeadm upgrade node

dnf install -y --disableexcludes=kubernetes \
  kubelet-${PKG_TARGET} kubectl-${PKG_TARGET}
systemctl daemon-reload
systemctl restart kubelet

# Back from the CP:
kubectl uncordon wk-1
kubectl get nodes -o wide | grep wk-1
# wk-1 should report v1.30.x and Ready

One worker at a time. If pod rescheduling on the remaining workers causes pressure (CPU/memory headroom too tight), pause between workers until the scheduler settles. The “do all workers in parallel” instinct is wrong — you exchange a five-minute window where capacity is reduced for a thirty-second window where capacity is gone.

Phase 4 — post-checks

# All nodes on the target version
kubectl get nodes -o wide | awk 'NR==1 || $5 != "v1.30.4" {print}'

# All system pods Ready
kubectl -n kube-system get pods --field-selector=status.phase!=Running

# Event sweep for the last 30 minutes
kubectl get events -A --sort-by='.lastTimestamp' | tail -50

# CoreDNS rollout sanity
kubectl -n kube-system rollout status deploy/coredns

# Etcd post-snapshot, kept
ETCDCTL_API=3 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 /var/backups/etcd-post-upgrade-$(date +%F).db
rsync -a /var/backups/etcd-post-upgrade-*.db backup-host:/srv/etcd-snapshots/

# Smoke test a workload that exercises DNS, networking, service discovery
kubectl run smoke --image=ghcr.io/nicolaka/netshoot:v0.13 -it --rm --restart=Never -- \
  bash -c 'dig +short kubernetes.default.svc.cluster.local && \
           curl -sk https://kubernetes.default/healthz?verbose | head -5'

If any of those fail, do not proceed to upgrade the next cluster or remove the snapshot. Investigate first.

Rollback

A kubeadm minor upgrade is not formally reversible mid-flight, but the practical rollback is: stop, restore the etcd snapshot to a fresh control plane, reinstall the previous packages. That’s why the snapshot off-node before phase 1 is non-negotiable. The runbook for a full control-plane DR — including the restore — is in k8s-control-plane-disaster-recovery.

For a typical three-CP + N-worker cluster, the entire upgrade is two to four hours of clock time with zero data-plane downtime if done one node at a time. Doing it all in fifteen minutes is technically possible and a recipe for the one outage you’ll spend a year explaining.

Stack Harbor runs Kubernetes upgrades for customers under environment management — one minor at a time, drained, snapshotted, change-windowed. If you’d like the next upgrade run by someone who’s done a hundred of them, book a scoping conversation.