Kubernetes Release Format and Upgrade Process
Kubernetes Release Format
Kubernetes follows a semantic versioning format: vX.Y.Z
, where:
X
is the major version.Y
is the minor version.Z
is the patch version.
Note: ETCD and CoreDNS have separate versioning. All other Kubernetes components typically share the same version.
Upgrade Process
Key Points
- Kubernetes upgrades should be done one minor version at a time (e.g., from
v1.30
tov1.31
). - The upgrade involves first upgrading the master node(s) and then the worker nodes.
- During a master node upgrade, management operations are temporarily unavailable, but running pods remain unaffected.
Upgrade Steps
1. Upgrade Master Node
Find the Latest Patch Version
- Check for the latest version in your current minor release:
Look for the latest patch version in the format
sudo apt update sudo apt-cache madison kubeadm
1.31.x-*
.
Upgrade kubeadm
- Upgrade
kubeadm
to the desired version:sudo apt-mark unhold kubeadm && \ sudo apt-get update && sudo apt-get install -y kubeadm='1.30.2-1.1' && \ sudo apt-mark hold kubeadm
Plan the Upgrade
-
View the available upgrade plan:
sudo kubeadm upgrade plan
-
Apply the upgrade:
sudo kubeadm upgrade apply vX.XX.0
Verify Node Versions
- Check the node versions:
kubectl get nodes
Drain the Node
- Safely drain the node:
kubectl drain <node-to-drain> --ignore-daemonsets
Upgrade kubelet
and kubectl
- Update
kubelet
andkubectl
:sudo apt-mark unhold kubelet kubectl && \ sudo apt-get update && sudo apt-get install -y kubelet='1.30.2-1.1' kubectl='1.30.2-1.1' && \ sudo apt-mark hold kubelet kubectl
Restart and Uncordon the Node
- Restart
kubelet
and uncordon the node:sudo systemctl daemon-reload sudo systemctl restart kubelet kubectl uncordon <node-to-uncordon>
2. Upgrade Worker Nodes
Follow the same process as for the master node. Alternatively, refer to the official documentation (opens in a new tab).
Drain the Node
- Drain the worker node before the upgrade:
kubectl drain <worker-node-name> --ignore-daemonsets
Perform the Upgrade
- Upgrade
kubeadm
,kubelet
, andkubectl
on the worker node.
Restart and Uncordon the Node
- Restart the services and uncordon the worker node:
sudo systemctl daemon-reload sudo systemctl restart kubelet kubectl uncordon <worker-node-name>
Post-Upgrade Validation
-
Verify that all nodes are in the
Ready
state:kubectl get nodes
-
Ensure all pods are running as expected:
kubectl get pods -A
https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/ (opens in a new tab)