Blog

Upgrading a Kubernetes Cluster Using Kubeadm

Picture of Boyan Kirov
Boyan Kirov
DevOps & Cloud Engineer
02.02.2024
Reading time: 2 mins.
Last Updated: 04.03.2025

Table of Contents

Note: The following example demonstrates upgrading a Kubernetes cluster from version 1.23 to 1.24. Replace the version numbers according to your specific setup.

Upgrading a Kubernetes Cluster Using Kubeadm

To ensure a seamless upgrade, it’s crucial to follow these steps in order:

  1. Upgrade the Control Plane node.
  2. Upgrade Worker Nodes.

Additionally, upgrade the following components on both the control plane and worker nodes:

  • Kubeadm
  • Kubelet
  • Kubectl

Before commencing the upgrade process, be sure to identify the cluster and node names. Execute the following command to retrieve the node names:

kubectl get nodes

Upgrade the Control Plane (Master Node)

Step 1: Check the existing Kubeadm version

Log in to the control plane and check the existing version using the following command:

kubeadm version -o json

Step 2: Decide on the upgrade version

Obtain a list of available Kubeadm versions:

sudo apt update
sudo apt-cache madison kubeadm | tac

Alternatively, run a kubeadm upgrade plan for upgrade suggestions:

sudo kubeadm upgrade plan

Step 3: Unhold kubeadm and Install the required version

Unhold kubeadm and install the desired version:

sudo apt-mark unhold kubeadm && \
sudo apt-get update && sudo apt-get install -y kubeadm=1.24.6-00 && \
sudo apt-mark hold kubeadm

Step 4: Apply Kubeadm upgrade

Apply the upgrade:

sudo kubeadm upgrade node

Step 5: Evict all workloads from the control plane

To apply the upgrade, evict all workloads except daemonsets:

kubectl drain master-node --ignore-daemonsets

If using local storage, include –delete-local-data:

sudo kubectl drain master-node --ignore-daemonsets --delete-local-data

Step 6: Upgrade Kubelet and Kubectl

Unhold and upgrade kubectl and kubelet:

sudo apt-mark unhold kubelet kubectl && \

sudo apt-get update && sudo apt-get install -y kubelet=1.24.6-00 kubectl=1.24.6-00 && \

sudo apt-mark hold kubelet kubectl\

Restart the services:

sudo systemctl daemon-reload
sudo systemctl restart kubelet

Step 7: Uncordon the Node and Verify the Node Status

Uncordon the control plane node:

kubectl uncordon master-node

Verify the node status and version:

kubectl get nodes
Uncordon the Node and Verify the Node Status

Upgrade Worker Nodes

Step 1: Unhold Kubeadm and Install Required Version

Install the required version of Kubeadm on worker nodes:

sudo apt-mark unhold kubeadm && \
sudo apt-get update && sudo apt-get install -y kubeadm=1.24.6-00 && \
sudo apt-mark hold kubeadm

Step 2: Upgrade Kubeadm

Run the following command on each worker node:

sudo kubeadm upgrade node

Step 3: Drain the Node

Evict all pods on the worker node by draining it:

kubectl drain worker-node01 --ignore-daemonsets

Step 4: Upgrade Kubelet & Kubectl

Upgrade kubelet and kubectl:

sudo apt-mark unhold kubelet kubectl && \
sudo apt-get update && sudo apt-get install -y kubelet=1.24.6-00 kubectl=1.24.6-00 && \
sudo apt-mark hold kubelet kubectl

Restart kubelet:

sudo systemctl daemon-reload
sudo systemctl restart kubelet

Step 5: Uncordon worker node

kubectl uncordon worker-node01

Verify Cluster Upgrade

Check if the cluster is upgraded and operational

kubectl get nodes

Verify the status of all cluster components:

kubectl get --raw='/readyz?verbose'
curl -k https://localhost:6443/livez?verbose

Also, ensure that all kube-system control node pods are running:

kubectl get po -n kube-system

This completes the Kubernetes cluster upgrade process.

Leave a Reply

Newsletter for Tech experts

Signal, not noise -

straight to your inbox.

Join 12,000+ engineers and business leaders getting field notes on SRE, DevOps and cloud- native reliability.

Deep-dive tech blogs & case studies
Emerging tech, curated

Your Work Email

We respect your inbox. Read our Privecy Policy

More Posts

AI SRE Agent: Turning the First 20 Minutes of an Incident Into Automation It’s 3am. An alert fires. You open your laptop, and the next twenty minutes look like every...
Reading
Managing secrets securely in Kubernetes is a critical challenge for modern cloud-native environments. Application credentials, certificates, private keys, and passwords must be handled in a way that is secure, auditable,...
Reading
Get In Touch
ITGix provides you with expert consultancy and tailored DevOps services to accelerate your business growth.
Newsletter for
Tech Experts
Join 12,000+ business leaders and engineers who receive blogs, e-Books, and case studies on emerging technology.