Requirements & constraints:- 3 control-plane replicas across 3 zones (must maintain quorum: etcd majority = 2)- Minimal disruption, rolling upgrade, full rollback plan, backups (etcd)- Using kubeadm-managed cluster (adjust if provider-managed)High-level plan:1) Pre-checks and snapshot2) Upgrade control-plane replicas one-at-a-time (zone-by-zone)3) Upgrade worker nodes in batches with drains4) Post-upgrade validation and cleanupDetailed steps with commands and checks:Pre-checks & etcd snapshot- Verify cluster healthy:bash
kubectl get nodes
kubectl get pods -n kube-system -l component=kube-apiserver
kubectl get cs # if available; otherwise check component pods
- Take etcd snapshot on a control-plane host (use etcdctl v3; run on leader or any member with certs):bash
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/peer.crt \
--key=/etc/kubernetes/pki/etcd/peer.key snapshot save /var/backups/etcd-snap-$(date +%F_%T).db
- Verify snapshot:bash
ETCDCTL_API=3 etcdctl snapshot status /var/backups/etcd-snap-*.db
- Confirm etcd cluster health and quorum:bash
ETCDCTL_API=3 etcdctl --endpoints=$(echo MEMBER_ENDPOINTS) endpoint status --write-out=table
ETCDCTL_API=3 etcdctl --endpoints=$(echo MEMBER_ENDPOINTS) endpoint health
Control-plane rolling upgrade (one replica at a time)For each control-plane node (order: non-leader first ideally; avoid rebooting >1 member):- Pick node A.- Cordon node (optional for control-plane pods managed by static pods):bash
kubectl cordon <node-A>
- SSH to node, drain only workloads if any (ignore DaemonSets, but don't evict control-plane static pods):bash
kubectl drain <node-A> --ignore-daemonsets --delete-local-data --force
- Upgrade kubeadm and kubelet to target version:bash
# On node
apt-get update && apt-get install -y kubeadm=<VERSION>
kubeadm upgrade node
systemctl restart kubelet
- Upgrade control-plane components (if using kubeadm):bash
kubeadm upgrade apply <VERSION> # run from a control-plane node; but only perform for that node if using patch approach
(If control-plane is static pods: replace manifests under /etc/kubernetes/manifests or use kubeadm; follow distro-specific instructions.)- After restart, verify:bash
kubectl get pods -n kube-system -o wide
kubectl get cs
ETCDCTL_API=3 etcdctl endpoint status --write-out=table
kubectl get nodes
Ensure etcd member rejoined and quorum maintained (at least 2/3 healthy).Repeat for other control-plane nodes one-by-one, verifying quorum and API availability between each.Worker node upgrade (batched to preserve capacity)- Define batch size (e.g., 25-33% nodes per zone).For each batch:- Cordon & drain node:bash
kubectl cordon <worker>
kubectl drain <worker> --ignore-daemonsets --delete-local-data
- Upgrade kubeadm, kubelet, kubectl on node:bash
apt-get install -y kubeadm=<VERSION>
kubeadm upgrade node
systemctl restart kubelet
- Uncordon after checks:bash
kubectl uncordon <worker>
kubectl get pods -o wide --field-selector spec.nodeName=<worker>
- Health checks per node: - kubelet status: `systemctl status kubelet` - Node Ready: `kubectl get node <worker> -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'` - Application pod readiness and service endpoints: `kubectl get pods -A -o wide`, `kubectl get endpoints`Post-upgrade validations- All nodes Ready:- API responsiveness and control-plane pods healthy:bash
kubectl get pods -n kube-system
kubectl get cs
- etcd health & member list:bash
ETCDCTL_API=3 etcdctl endpoint status --write-out=table
ETCDCTL_API=3 etcdctl member list
- Run a smoke test of applications, check metrics/alerts (Prometheus, Grafana), and run conformance e2e if available.Rollback considerations- If etcd corrupted: restore snapshot on new cluster or on nodes:bash
ETCDCTL_API=3 etcdctl snapshot restore /path/to/snap.db --data-dir=/var/lib/etcd-from-backup
# then adjust systemd unit or manifests to point to restored data-dir, start etcd
- If control-plane binary downgrade needed, follow kubeadm downgrade docs and don't mix versions that violate skew policy.Key operational notes / checks- Maintain etcd quorum: never reboot more than one control-plane at a time.- Monitor API latency and error rates (alert if SLO thresholds exceeded).- Keep Kubernetes version skew rules in mind: kubelet can be at most +1 minor ahead of control plane.- Schedule maintenance in low-traffic windows and inform stakeholders.This plan balances safety (snapshots, quorum checks), minimal disruption (single-member control-plane upgrades), and observability (explicit commands/health checks before and after each step).