Upgrade a Kubernetes cluster on RHEL

Check latest available version

# Check latest available version
yum list --showduplicates kubeadm --disableexcludes=kubernetes

# Example output
kubeadm.x86_64                                                                         1.22.1-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.2-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.3-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.4-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.5-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.6-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.7-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.8-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.9-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.22.10-0                                                                         kubernetes 
kubeadm.x86_64                                                                         1.22.11-0                                                                         kubernetes 
kubeadm.x86_64                                                                         1.22.12-0                                                                         kubernetes 
kubeadm.x86_64                                                                         1.23.0-0                                                                          kubernetes 
kubeadm.x86_64                                                                         1.23.1-0                                                                          kubernetes

Upgrade kubeadm

# Select a version to upgrade :kubeadm-1.23.x-0 
yum install -y kubeadm-1.23.x-0 --disableexcludes=kubernetes

# Check kubeadm version
kubeadm version

# Check upgrade plan
kubeadm upgrade plan --ignore-preflight-errors=CoreDNSUnsupportedPlugins,CoreDNSMigration

# Apply upgrade
kubeadm upgrade apply v1.23.9 --ignore-preflight-errors=CoreDNSUnsupportedPlugins,CoreDNSMigration

Upgrade kubelet and kubectl

# replace x in 1.23.x-0 with the latest patch version
yum install -y kubelet-1.23.x-0 kubectl-1.23.x-0 --disableexcludes=kubernetes

# Restart the kubelet:
sudo systemctl daemon-reload
sudo systemctl restart kubelet

Verify status of cluster

# verify
kubectl get nodes
# Output
NAME    STATUS   ROLES                  AGE    VERSION
rhel8   Ready    control-plane,master   281d   v1.23.9

Reference :

https://v1-23.docs.kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/