Sub topic 4
Version skew: which components may differ and by how much
This chapter assumes you know the control plane and worker node roles, and that you can run basic kubectl commands.
What version skew is
Version skew is the difference in version between Kubernetes components that run together. Components are not upgraded at the same instant, so Kubernetes defines how far apart they may be. The rules are in the version skew policy. They use minor versions, the middle number in 1.31.4.
The rules
The kube-apiserver is the reference point. The other components are measured against it.
| Component | Allowed relative to kube-apiserver |
|---|---|
| kube-apiserver (several instances in an HA setup) | Instances may differ by at most one minor version |
| kube-controller-manager, kube-scheduler, cloud-controller-manager | Not newer than the apiserver. Up to one minor version older |
| kubelet | Not newer than the apiserver. Up to three minor versions older (two on clusters older than 1.28) |
| kube-proxy | Not newer than the apiserver. Up to three minor versions older (two before 1.28). Also within the same range of the kubelet on its node |
| kubectl | One minor version older or newer |
For example, with an apiserver at 1.31, kubelets may be 1.28 to 1.31, and kubectl may be 1.30 to 1.32. A kubelet at 1.32 would be invalid.
The skew limits for the kubelet and kube-proxy changed between releases. Check the policy page for your target version before you rely on these numbers.
Why the order is fixed
Because no component may be newer than the apiserver, the apiserver must be upgraded first. Nodes come after the control plane. This gives the upgrade order:
With several control plane nodes, upgrade them one at a time. During that time the apiserver instances differ by one minor version, which the policy allows. kubeadm handles the order inside the control plane for you.
Checking your current skew
# Client and server versions
kubectl version
# The kubelet version on every node
kubectl get nodes -o wideThe VERSION column in kubectl get nodes is the kubelet version. Compare it with the server version from kubectl version.
Skipping versions
The control plane upgrades one minor version at a time. You cannot go from 1.29 to 1.31 directly. Nodes have more freedom. Within the kubelet limit, you can upgrade the control plane through several minor versions and leave nodes behind. For example, you could go from 1.28 to 1.30 in steps and then upgrade nodes straight to 1.30. This is valid only while the kubelets stay within the allowed skew at every step.
Common mistakes
- Upgrading
kubectlon a laptop to two minor versions ahead of the cluster, which leaves it outside the one-version window. - Upgrading nodes before the control plane, which makes the kubelet newer than the apiserver.
- Leaving old nodes in place for several upgrade rounds until the kubelet is more than three minor versions behind.
Exercise
A cluster has a kube-apiserver at 1.30 and kubelets at 1.27. You want to upgrade the control plane to 1.31 next. Is the cluster inside the skew policy now, and what happens after the upgrade?
Show answer
Now it is valid: a kubelet may be up to three minor versions older than the apiserver (1.27 vs 1.30). After the control plane reaches 1.31, the kubelets are four minor versions behind, which breaks the policy. Upgrade the nodes to at least 1.28 first, or plan to upgrade them as soon as the control plane is done, so the skew is within limits before relying on the cluster.