This lesson demonstrates upgrading a Kubernetes cluster from version 1.28 to 1.29 using kubeadm, following official documentation procedures.
In this lesson, we’ll demonstrate upgrading a Kubernetes cluster from version 1.28 to 1.29 using kubeadm. The procedure follows the official Kubernetes documentation under “Tasks → Administer Cluster → Administration with KubeADM → Upgrading a KubeADM Cluster.” Although the documentation provides upgrade paths for various version transitions, this demo focuses on moving from v1.28 to the latest v1.29 release.
Select the upgrade path that best suits your environment and follow the provided commands. The process remains largely consistent regardless of the version specifics.
Before starting the upgrade, scroll down the official documentation until you find the important note about changing the package repository. Previously, Kubernetes packages were hosted at app.kubernetes.io and yum.kubernetes.io, but these repositories have been deprecated. You must now use packages.k8s.io to download the latest versions of tools such as kubectl and kubeadm.
Before proceeding, ensure that you update the package repository configuration on every cluster node.
On a two-node cluster (one control-plane and one worker node), you can verify your distribution with:
Copy
Ask AI
cat /etc/*release
If the output indicates Ubuntu 20.04 or another Debian-based distribution, follow the Debian/Ubuntu instructions in the documentation and update your package repository accordingly.For instance, initially run a command like this:
Before applying the upgrade, conduct a dry run to see the available upgrade options. This command will outline which components upgrade automatically and those requiring manual updates (e.g., kubelet):
Copy
Ask AI
sudo kubeadm upgrade plan
The output should indicate that your cluster is currently at v1.28.0 with the target control plane version of v1.29.3. Typically, kubeadm upgrades essential components such as the API server, controller manager, scheduler, and kube-proxy automatically, while kubelet must be updated separately.
Initiate the upgrade process for the control plane:
Copy
Ask AI
sudo kubeadm upgrade apply v1.29.3
Monitor the progress as the system renews certificates, updates static pod manifests, and restarts components. After a successful upgrade, you may see messages similar to:
Copy
Ask AI
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.29.3". Enjoy![upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.
Keep in mind that when you verify node versions via kubectl get nodes, the displayed version corresponds to the kubelet, which will still show v1.28.0 until its upgrade is completed.
Drain the worker node to safely upgrade kubelet. Replace <node-name> with the actual name of your worker node:
Copy
Ask AI
kubectl drain <node-name> --ignore-daemonsets
If you encounter issues related to DaemonSet-managed pods, ensure that the --ignore-daemonsets flag is used correctly. Refer to kubectl drain --help for further details if needed.
This guide has detailed the process of upgrading a Kubernetes cluster using kubeadm. The critical steps include:
Updating the package repository to packages.k8s.io.
Determining the target version available from the repository.
Upgrading the control plane by updating kubeadm, applying the upgrade, and then updating kubelet and kubectl.
Draining nodes before performing kubelet upgrades and uncordoning them afterwards.
Repeating the process on each worker node.
By following these steps, you ensure that every component of your Kubernetes cluster is updated properly, maintaining compatibility with the newer version. Happy upgrading!