0
0
Kubernetesdevops~10 mins

Cluster upgrade strategies in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Cluster upgrade strategies
Start: Current Cluster Version
Choose Upgrade Strategy
In-place
Upgrade Nodes
Verify & Test
Complete Upgrade & Cleanup
End
This flow shows the main steps in upgrading a Kubernetes cluster using different strategies: in-place, blue-green, and canary/rolling upgrades.
Execution Sample
Kubernetes
kubectl drain node1 --ignore-daemonsets
# Upgrade node (e.g., kubeadm upgrade node on node1)
kubectl uncordon node1
This sequence drains a node, upgrades it, then brings it back to the cluster.
Process Table
StepActionNode StateCluster StateResult
1Drain node1cordoned, pods evictedReady nodes reduced by 1Node1 ready for upgrade
2Upgrade node1upgradingCluster running with node1 offlineNode1 updated to new version
3Uncordon node1readyAll nodes ready, cluster upgradedNode1 back in service
4Verify clusterall nodes readyCluster version updatedUpgrade successful
5ExitN/AN/AUpgrade complete, cluster stable
💡 All nodes upgraded and cluster is stable with new version
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
node1_statereadycordonedupgradingreadyready
cluster_ready_nodes32233
cluster_versionv1.20v1.20v1.20v1.21v1.21
Key Moments - 3 Insights
Why do we drain the node before upgrading?
Draining the node safely evicts pods so workloads move to other nodes, preventing downtime during upgrade (see execution_table step 1).
What happens if we uncordon the node before upgrade finishes?
The node might be unstable or incompatible, causing errors. The upgrade must complete before uncordoning (see execution_table step 3).
How does cluster version change during upgrade?
Cluster version updates only after node upgrade completes and node rejoins ready state (see variable_tracker cluster_version changes at step 3 and 4).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the node1 state after step 2?
Aupgrading
Bready
Ccordoned
Ddrained
💡 Hint
Check the 'Node State' column for step 2 in the execution_table.
At which step does the cluster version update?
AStep 1
BStep 2
CStep 4
DStep 3
💡 Hint
Look at the 'cluster_version' variable in variable_tracker after each step.
If we skip draining the node, what likely happens?
ANode upgrades faster
BPods remain running on node during upgrade, causing downtime
CCluster version updates automatically
DNode is automatically uncordoned
💡 Hint
Refer to key_moments about why draining is important before upgrade.
Concept Snapshot
Cluster Upgrade Strategies:
- In-place: drain node, upgrade, uncordon
- Blue-Green: create new cluster, switch traffic
- Canary/Rolling: upgrade subset, monitor, rollback if needed
Always drain nodes before upgrade to avoid downtime.
Verify cluster stability after upgrade.
Full Transcript
This visual execution shows how Kubernetes cluster upgrades happen step-by-step. First, you drain a node to safely move workloads away. Then you upgrade the node software. After upgrade, you uncordon the node to bring it back into service. The cluster version updates only after nodes are upgraded and ready. This prevents downtime and keeps the cluster stable. Different strategies like in-place, blue-green, or canary upgrades exist, but all require careful node management and verification.