Sub topic 15
Upgrading Kubernetes Versions Safely
This chapter assumes you can create a cluster with eksctl, run kubectl, and read a managed node group config from the earlier chapters. It follows one upgrade from Kubernetes 1.31 to 1.32 on the demo cluster.
Why upgrades are a routine task
Kubernetes ships a minor version about three times a year. EKS supports each version for a limited time. After standard support ends, the cluster moves to extended support, which costs more per hour, so staying current also controls cost. Plan an upgrade every few months instead of waiting for a deadline.
Who upgrades what
EKS upgrades the control plane for you when you ask. You are responsible for everything in the data plane: nodes, add-ons, and your own manifests. Two rules shape the whole process:
- You upgrade one minor version at a time. You cannot go from 1.30 to 1.32 in a single step.
- A control plane upgrade cannot be rolled back. Check your workloads before you start.
Kubelets on nodes may be older than the API server, within the supported version skew. Never run nodes newer than the control plane.
Step 1: Check before you start
Newer Kubernetes versions remove old APIs. A manifest that uses a removed API will fail after the upgrade. Open the cluster in the EKS console and read the upgrade insights, which flag deprecated API calls seen by the API server. Also read the release notes for the target version, and confirm your add-ons have a compatible release.
Step 2: Upgrade the control plane
eksctl upgrade cluster --name demo --region us-east-1 --version 1.32 --approveEKS replaces the control plane instances behind the scenes. The API stays available, and your pods keep running. The update usually takes several minutes.
Step 3: Upgrade add-ons
The VPC CNI, CoreDNS and kube-proxy each have versions matched to the cluster version. Update each one:
aws eks update-addon --cluster-name demo --addon-name coredns \
--resolve-conflicts PRESERVE --region us-east-1Repeat for kube-proxy and vpc-cni. PRESERVE keeps any settings you changed by hand instead of overwriting them.
Step 4: Upgrade the nodes
For a managed node group, EKS launches new nodes on the new version, cordons and drains the old ones, and then terminates them.
eksctl upgrade nodegroup --name ng-1 --cluster demo \
--kubernetes-version 1.32 --region us-east-1Draining respects PodDisruptionBudgets. A budget tells Kubernetes how many replicas of an app must stay up. Without one, a drain can evict all your pods at once.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: web
spec:
minAvailable: 1
selector:
matchLabels:
app: webCommon errors
- Upgrade blocked or pods failing afterward: a manifest uses a removed API. Fix it before the upgrade, because you cannot undo it.
- Drain stalls: a PodDisruptionBudget is too strict, for example
minAvailableequal to the replica count. UseminAvailable: 1with at least two replicas. - Not enough IP addresses: surge nodes need extra addresses from your subnets during the rollout.
- Self-managed nodes left behind: EKS does not upgrade them. You must replace them yourself.
Step 5: Verify
kubectl get nodes
kubectl get pods -AEvery node should show the new version, and pods should be Running.
Exercise
Your cluster runs 1.30 and you want 1.32. What do you do, and why can't you skip a step?
Show answer
Upgrade to 1.31 first, run through the full order (control plane, add-ons, nodes, verify), then repeat for 1.32. EKS allows only one minor version per control plane upgrade, and the upgrade cannot be rolled back, so each step needs its own check.