Skip to main content

Overview

This article walks the installer through the process of upgrading K8S from a previous version. In working through the installation, references will be made as appropriate to provide context.

System Parameters/Versions:

  • Base OS:
    • Amazon Linux 2023: ami-05576a079321f21f8
    • Rocky 8.10
  • K8S
    • current version: v1.30.9
    • upgrade version: v1.31.7

Requirements:

K8S must be upgraded incrementally from each version. As an example, if upgrading from v1.29 to v1.31, you must install each increment and repeat the process until the desired version is installed:
  • v1.29 → v1.30
  • v1.30 → v1.31
In this example, upgrading from v1.30 to v1.31 so only need to apply the process once.

Upgrade K8S

Step 1: Check Current Versions

kubeadm, kubelet, and kubectl versions must match. Verify that the current versions are the same: kubeadm version:
Example output:
kubectl version:
Example output:
kubelet version:
Example output:

Step 2: Update Base OS

On ALL nodes in the cluster (master, worker, and gpu). Each base OS has different package updates.
  • Amazon Linux 2023:
  • Rocky 8:

Step 3: Update Repository Config

On ALL nodes in the cluster (master, worker, and gpu), update repository config file to desired version. In this example, using v1.31:

Step 4: Upgrade Control Plane Kubeadm

On the master node, upgrade kubeadm. Worker/GPUs nodes will be updated separately. Get list of possible upgrade versions:
Example output:
Install new kubeadm version:
Check new version:
Example output:

Step 5: Upgrade Control Plane Components

On the master node, upgrade control plane components. Run a plan to show what can/will be updated:
Example output shows the possible v1.30 and 1.31 minor/patch upgrades. For this example, upgrading minor version to 1.31.7:
Upgrade to minor version v1.31.7 (can take up to five mins to complete):
When complete, view kube-system pods. If the upgrade was successful, the kube* pods will have a newer age than the others:
Example output (upgrade was executed 13h ago):

Step 6: Upgrade Control Plane Kubectl and Kubelet

On the master node, upgrade kubectl and kubelet components. Versions need to match kubeadm from previous steps (v1.31.7):
Restart the kubelet daemon:
After upgrading kubectl, need to export config:
Verify kubectl version:
Example output:
List all nodes to verify that the control-plane (master node) kubelet was upgraded successfully to v1.31.7 (other nodes will still show previous version):
Example output:

Step 7: Upgrade Worker/GPU Node Components

Although the worker and gpu nodes can be upgraded in parallel, it is highly recommended to only upgrade ONE node at a time. kubeadm and kubectl are not required on the worker/gpu nodes (only kubelet); however, in this example going to install all three for possible future use.
NOTE: if workloads/pods need to remain running during upgrade, each node must be drained, cordoned, and pods rescheduled. This example assumes that the cluster is not operational and that the pods will not be reachable until the upgrade is complete.
Execute each of the following steps on the worker and gpu nodes. Upgrade kubeadm:
Verify kubeadm upgrade:
Example output:
Upgrade kubelet and kubectl:
Restart the kubelet daemon:
Verify kubectl upgrade:
Example output:

Step 8: Verify all Nodes Upgraded

On the master node (control plane), confirm the correct kubelet version for all nodes:
Example output: