Solve this question on: ssh cks8930
The cluster is running Kubernetes 1.31.5, update it to 1.32.1.
Requirements:
First, let's check the current versions of all nodes:
➜ ssh cks8930
➜ candidate@cks8930:~# k get node
NAME STATUS ROLES AGE VERSION
cks8930 Ready control-plane 22h v1.31.5
cks8930-node1 Ready 22h v1.31.5
First, drain the control plane node:
➜ candidate@cks8930:~# k drain cks8930 --ignore-daemonsets
node/cks8930 cordoned
Warning: ignoring DaemonSet-managed Pods: kube-system/kube-proxy-wr9pz, kube-system/weave-net-z6qnn
node/cks8930 drained
Check current versions and upgrade plan:
➜ candidate@cks8930:~# sudo -i
➜ root@cks8930:~# kubelet --version
Kubernetes v1.31.5
➜ root@cks8930:~# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"32", GitVersion:"v1.32.1", GitCommit:"e9c9be4007d1664e68796af02b8978640d2c1b26", GitTreeState:"clean", BuildDate:"2025-01-15T14:39:14Z", GoVersion:"go1.23.4", Compiler:"gc", Platform:"linux/amd64"}
➜ root@cks8930:~# kubeadm upgrade plan
[preflight] Running pre-flight checks.
[upgrade/config] Reading configuration from the "kubeadm-config" ConfigMap in namespace "kube-system"...
[upgrade] Running cluster health checks
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: 1.31.5
[upgrade/versions] kubeadm version: v1.32.1
[upgrade/versions] Target version: v1.32.1
Apply the upgrade:
➜ root@cks8930:~# kubeadm upgrade apply v1.32.1
[upgrade] Reading configuration from the "kubeadm-config" ConfigMap in namespace "kube-system"...
[upgrade] Use 'kubeadm init phase upload-config --config your-config.yaml' to re-upload it.
[upgrade/preflight] Running preflight checks
[upgrade] Running cluster health checks
[upgrade/preflight] You have chosen to upgrade the cluster version to "v1.32.1"
[upgrade/versions] Cluster version: v1.31.5
[upgrade/versions] kubeadm version: v1.32.1
[upgrade] Are you sure you want to proceed? [y/N]: y
...
Upgrade kubelet and kubectl:
➜ root@cks8930:~# apt update
➜ root@cks8930:~# apt install kubelet=1.32.1-1.1 kubectl=1.32.1-1.1
➜ root@cks8930:~# apt-mark hold kubelet kubectl
➜ root@cks8930:~# service kubelet restart
Verify the control plane upgrade:
➜ root@cks8930:~# k get node
NAME STATUS ROLES AGE VERSION
cks8930 Ready,SchedulingDisabled control-plane 22h v1.32.1
cks8930-node1 Ready 22h v1.31.5
Uncordon the control plane node:
➜ root@cks8930:~# k uncordon cks8930
First, drain the worker node:
➜ root@cks8930:~# k drain cks8930-node1 --ignore-daemonsets
node/cks8930-node1 cordoned
Warning: ignoring DaemonSet-managed Pods: kube-system/kube-proxy-gjtxp, kube-system/weave-net-l2pf8
...
Connect to the worker node and upgrade kubeadm:
➜ root@cks8930:~# ssh cks8930-node1
➜ root@cks8930-node1:~# apt update
➜ root@cks8930-node1:~# apt-mark unhold kubeadm
➜ root@cks8930-node1:~# apt install kubeadm=1.32.1-1.1
➜ root@cks8930-node1:~# apt-mark hold kubeadm
Upgrade the node configuration:
➜ root@cks8930-node1:~# kubeadm upgrade node
Upgrade kubelet and kubectl:
➜ root@cks8930-node1:~# apt-mark unhold kubectl kubelet
➜ root@cks8930-node1:~# apt install kubelet=1.32.1-1.1 kubectl=1.32.1-1.1
➜ root@cks8930-node1:~# service kubelet restart
Check the node versions:
➜ root@cks8930:~# k get node
NAME STATUS ROLES AGE VERSION
cks8930 Ready control-plane 22h v1.32.1
cks8930-node1 Ready,SchedulingDisabled 22h v1.32.1
Uncordon the worker node:
➜ root@cks8930:~# k uncordon cks8930-node1
➜ root@cks8930:~# k get node
NAME STATUS ROLES AGE VERSION
cks8930 Ready control-plane 22h v1.32.1
cks8930-node1 Ready 22h v1.32.1