
Updating Package Repositories
Before beginning the upgrade, review the updated package repository information. The legacy repositories (app.kubernetes.io and yum.kubernetes.io) have been deprecated. Moving forward, packages are available at packages.k8s.io. This repository now hosts the latest versions of essential tools such as kubectl and kubeadm.
Before proceeding, confirm that you are using the new package repositories.
Check the documentation and click the provided link for the latest
instructions.
Verify Your Node OS and Repository Setup
First, determine your node distribution because the commands differ slightly by operating system. For example, on a two-node cluster, run:Remember to adjust the version numbers (e.g., change to 1.29) in both commands
as needed during the upgrade process.
Upgrading the Control Plane
Step 1: Upgrade kubeadm
On the control plane node, list the available kubeadm versions:Step 2: Run the Upgrade Plan
Before applying the upgrade, conduct a dry run to ensure compatibility:Step 3: Apply the Control Plane Upgrade
Upgrade your control plane with:kubectl get nodes will still display version v1.28.0 for the kubelet.
Upgrading kubelet and kubectl on the Control Plane
Step 1: Drain the Control Plane Node
Before updating kubelet and kubectl, drain the control plane node:Step 2: Upgrade Packages
Next, upgrade kubelet and kubectl to version 1.29.3-1.1:Upgrading Worker Nodes
For each worker node, perform the following steps:-
Upgrade kubeadm:
-
Update Node Configuration:
Run the command on the control plane to update the node configuration:
This command refreshes the node configuration without upgrading the kubelet package.
-
Drain the Worker Node:
Use the node name (e.g., node01) to drain it:
-
Upgrade kubelet and kubectl:
Execute the following commands on the worker node:
Reload and restart kubelet:
-
Uncordon the Worker Node:
Summary
This guide detailed the process of upgrading a Kubernetes cluster using kubeadm by:- Updating package repositories to the new packages.k8s.io.
- Upgrading kubeadm on the control plane and verifying the available versions.
- Running a dry-run upgrade plan to check compatibility.
- Applying the control plane upgrade.
- Upgrading kubelet and kubectl on both the control plane and worker nodes while minimizing downtime by draining and uncordoning nodes.