Cyberithub

How to Upgrade Kubernetes Cluster to Some Specific Version [Step by Step]

Advertisements

In this article, I will take you through the steps to upgrade a Kubernetes Cluster. In any organization, upgrading Kubernetes cluster is one such daunting task that if not done properly, it might result in critical production loss. In reality, upgrading k8s cluster is much easier than you think given that you are following all the steps as it should be. Here I am going to show you how to upgrade two node cluster step by step to some specific version as per your requirement.

You can use the same method to upgrade your multi node clusters. I have broken down the upgrade process in smaller steps to make it easy for you to understand and track each of the commands with the output so that you can isolate and deal with any error in case it occurs. Check more about upgrading kubernetes clusters on the official website.

What is Kubeadm

Kubeadm is a tool built to provide kubeadm init and kubeadm join as best-practice "fast paths" for creating Kubernetes clusters. kubeadm performs the actions necessary to get a minimum viable cluster up and running. By design, it cares only about bootstrapping, not about provisioning machines.

What is Kubelet

The kubelet is the primary "node agent" that runs on each node. It can register the node with the apiserver using one of: the hostname, a flag to override the hostname, or specific logic for a cloud provider.

What is Kubectl

Kubectl is a kubernetes command line tool that allows us to run commands against Kubernetes clusters. We can use kubectl to deploy applications, inspect and manage cluster resources, and view logs.

Lab Setup

a) We are using 2 node cluster for our demo purpose - master and node1.

b) Our Kubernetes cluster are installed and running on Ubuntu 20.04 LTS OS.

c) We are using root user to run the upgrade commands.

d) We are upgrading our cluster from v1.19.0 to v1.20.0.

How to Upgrade Kubernetes Cluster to Some Specific Version [Step by Step]

How to Upgrade Kubernetes Cluster to Some Specific Version

Also Read: Unable to Drain out Kubernetes Cluster Node for Maintenance

Step 1: Check Cluster Version

First you need to check the current nodes and kubelet version by using kubectl get nodes command as shown below. As you can see, current kubelet version is 1.19.0.

root@master:~# kubectl get nodes
NAME   STATUS ROLES  AGE VERSION
master Ready  master 39m v1.19.0
node1  Ready  <none> 38m v1.19.0

You can also check the Cluster version by running kubectl version --short command as shown below.

root@master:~# kubectl version --short
Client Version: v1.19.0
Server Version: v1.19.0

 

Step 2: Check Current Apps

To check all the current apps running in our cluster, we can use kubectl get deployments.apps command as shown below. As you can see we have hello deployment currently running with 5 replica pods with all of them in ready state.

root@master:~# kubectl get deployments.apps
NAME  READY UP-TO-DATE AVAILABLE AGE
hello 5/5   5          5         7m11s

 

Step 3: Check Pods

If you check the status of all the pods using kubectl get pods -o wide then you can see that all the pods are either running in master or node1 node as shown below.

root@master:~# kubectl get pods -o wide
NAME                   READY STATUS  RESTARTS AGE   IP         NODE   NOMINATED NODE READINESS GATES
hello-746c87566d-5w2br 1/1   Running 0        7m47s 10.244.0.5 master <none>         <none>
hello-746c87566d-cc9zg 1/1   Running 0        7m47s 10.244.1.5 node1  <none>         <none>
hello-746c87566d-cx5nn 1/1   Running 0        7m46s 10.244.1.4 node1  <none>         <none>
hello-746c87566d-r44s4 1/1   Running 0        7m47s 10.244.1.3 node1  <none>         <none>
hello-746c87566d-zz9jq 1/1   Running 0        7m46s 10.244.0.4 master <none>         <none>
simple-webapp-1        1/1   Running 0        7m47s 10.244.1.2 node1  <none>         <none>

 

Step 4: Check available Version

To verify the currently upgrade plan, you need to run kubeadm upgrade plan command as shown below. As you can see the latest available version is showing as 1.19.16.

root@master:~# kubeadm upgrade plan
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.19.0
[upgrade/versions] kubeadm version: v1.19.0
I0109 16:00:28.147547 29204 version.go:252] remote version is much newer: v1.23.1; falling back to: stable-1.19
[upgrade/versions] Latest stable version: v1.19.16
[upgrade/versions] Latest stable version: v1.19.16
[upgrade/versions] Latest version in the v1.19 series: v1.19.16
[upgrade/versions] Latest version in the v1.19 series: v1.19.16

Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT CURRENT AVAILABLE
kubelet 2 x v1.19.0 v1.19.16

Upgrade to the latest version in the v1.19 series:

COMPONENT               CURRENT AVAILABLE
kube-apiserver          v1.19.0 v1.19.16
kube-controller-manager v1.19.0 v1.19.16
kube-scheduler          v1.19.0 v1.19.16
kube-proxy              v1.19.0 v1.19.16
CoreDNS                 1.7.0   1.7.0
etcd                    3.4.9-1 3.4.9-1

You can now apply the upgrade by executing the following command:

kubeadm upgrade apply v1.19.16

Note: Before you can perform this upgrade, you have to update kubeadm to v1.19.16.

_____________________________________________________________________


The table below shows the current state of component configs as understood by this version of kubeadm.
Configs that have a "yes" mark in the "MANUAL UPGRADE REQUIRED" column require manual config upgrade or
resetting to kubeadm defaults before a successful upgrade can be performed. The version to manually
upgrade to is denoted in the "PREFERRED VERSION" column.

API GROUP CURRENT VERSION PREFERRED VERSION MANUAL UPGRADE REQUIRED
kubeproxy.config.k8s.io v1alpha1 v1alpha1 no
kubelet.config.k8s.io v1beta1 v1beta1 no
_____________________________________________________________________

 

Step 5: Drain out Master Node

Before running a maintenance on master node, you need to evict all the pods from the master node using kubectl drain master command as shown below.

root@master:~# kubectl drain master
node/master already cordoned
error: unable to drain node "master", aborting command...

There are pending nodes to be drained:
master
error: cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/kube-flannel-ds-l72mp, kube-system/kube-proxy-bbvtm

Since the above command did not worked properly so now I will try to use --ignore-daemonsets option to deal with the above error and this time we see that it works fine.

root@master:~# kubectl drain master --ignore-daemonsets
node/master already cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/kube-flannel-ds-l72mp, kube-system/kube-proxy-bbvtm
evicting pod default/hello-746c87566d-zz9jq
evicting pod default/hello-746c87566d-5w2br
evicting pod kube-system/coredns-f9fd979d6-228q9
evicting pod kube-system/coredns-f9fd979d6-7dcpz
pod/hello-746c87566d-zz9jq evicted
pod/hello-746c87566d-5w2br evicted
pod/coredns-f9fd979d6-228q9 evicted
pod/coredns-f9fd979d6-7dcpz evicted
node/master evicted

If you now check the status, you can see that master node is set to SchedulingDisabled.

root@master:~# kubectl get nodes
NAME   STATUS                   ROLES  AGE VERSION
master Ready,SchedulingDisabled master 56m v1.19.0
node1  Ready                    <none> 55m v1.19.0

 

Step 6: Check Kubeadm Version

You also need to verify the current version of kubeadm by using kubeadm version command as shown below.

root@master:~# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:28:32Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}

 

Step 7: Update Your Server

Next step is to run apt update command to update the system cache with all the latest available packages from the Ubuntu repo as shown below.

root@master:~# apt update
Get:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:1 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [9383 B]
Get:3 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [25.7 kB]
Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [52.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1459 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]

 

Step 8: Find the Latest Patch

To find the latest available patch, you can run apt-cache madison kubeadm command as shown below.

root@master:~# apt-cache madison kubeadm
kubeadm | 1.23.1-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.23.0-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.5-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.4-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.3-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.2-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.1-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.0-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.8-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.7-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.6-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.5-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.4-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages

 

Step 9: Upgrade Kubeadm

Once we have the version to which kubeadm needs to be upgraded say 1.20.0 in our case, we need to run apt-get install -y --allow-change-held-packages kubeadm=1.20.0-00 command as shown below.

root@master:~# apt-get install -y --allow-change-held-packages kubeadm=1.20.0-00
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following held packages will be changed:
kubeadm
The following packages will be upgraded:
kubeadm
1 upgraded, 0 newly installed, 0 to remove and 53 not upgraded.
Need to get 7707 kB of archives.
After this operation, 111 kB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.20.0-00 [7707 kB]
Fetched 7707 kB in 0s (36.4 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 15149 files and directories currently installed.)
Preparing to unpack .../kubeadm_1.20.0-00_amd64.deb ...
Unpacking kubeadm (1.20.0-00) over (1.19.0-00) ...
Setting up kubeadm (1.20.0-00) ...

 

Step 10: Check Kubeadm Version

After successful installation if you now check the kubeadm version, you can see that it is upgraded to 1.20.0 as shown below.

root@master:~# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:57:36Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

 

Step 11: Upgrade Master

Once kubelet is upgraded, you can upgrade the master node by using kubeadm upgrade apply v1.20.0 command as shown below.

root@master:~# kubeadm upgrade apply v1.20.0
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade/version] You have chosen to change the cluster version to "v1.20.0"
[upgrade/versions] Cluster version: v1.19.0
[upgrade/versions] kubeadm version: v1.20.0
[upgrade/confirm] Are you sure you want to proceed with the upgrade? [y/N]: y
[upgrade/prepull] Pulling images required for setting up a Kubernetes cluster
[upgrade/prepull] This might take a minute or two, depending on the speed of your internet connection
[upgrade/prepull] You can also perform this action in beforehand using 'kubeadm config images pull'
.........................................
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.20.0". Enjoy!

 

Step 12: Check Version

After successful upgradation you can verify the current version by using kubectl version --short command as shown below.

root@master:~# kubectl version --short
Client Version: v1.19.0
Server Version: v1.20.0

 

Step 13: Upgrade Kubelet

Next step is to upgrade the kubelet to version 1.20.0 by using apt-get install -y --allow-change-held-packages kubelet=1.20.0-00 command as shown below.

root@master:~# apt-get install -y --allow-change-held-packages kubelet=1.20.0-00
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following held packages will be changed:
kubelet
The following packages will be upgraded:
kubelet
1 upgraded, 0 newly installed, 0 to remove and 53 not upgraded.
Need to get 18.8 MB of archives.
After this operation, 4000 kB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.20.0-00 [18.8 MB]
Fetched 18.8 MB in 0s (42.0 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 15149 files and directories currently installed.)
Preparing to unpack .../kubelet_1.20.0-00_amd64.deb ...
/usr/sbin/policy-rc.d returned 101, not running 'stop kubelet.service'
Unpacking kubelet (1.20.0-00) over (1.19.0-00) ...
Setting up kubelet (1.20.0-00) ...
/usr/sbin/policy-rc.d returned 101, not running 'start kubelet.service'

 

Step 14: Check Version

After successfully upgrading kubelet to 1.20.0, you can verify the status by running kubectl get nodes command as shown below.

root@master:~# kubectl get nodes
NAME   STATUS                   ROLES  AGE VERSION
master Ready,SchedulingDisabled master 86m v1.20.0
node1  Ready                    <none> 85m v1.19.0

Sometimes the updated kubelet version does not show here. So in that case you need to restart the kubelet service once by using systemctl restart kubelet command as shown below.

root@master:~# systemctl restart kubelet

 

Step 15: Uncordon Master

Once the master node upgradation is completed, it is time to mark the node to schedulable again by running kubectl uncordon master command as shown below. This will tell the cluster that the node is now ready to host the pods again.

root@master:~# kubectl uncordon master
node/master uncordoned

You can again verify the status by using kubectl get nodes command as shown below.

root@master:~# kubectl get nodes
NAME   STATUS ROLES  AGE VERSION
master Ready  master 94m v1.20.0
node1  Ready  <none> 93m v1.19.0

 

Step 16: Drain node1

After completing the master, move to next node which is node1. In this node also, you need to first cordoned it by using kubectl drain node1 --ignore-daemonsets --force command as shown below.

root@master:~# kubectl drain node1 --ignore-daemonsets --force
node/node1 already cordoned
WARNING: deleting Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: default/simple-webapp-1; ignoring DaemonSet-managed Pods: kube-system/kube-flannel-ds-bjlf2, kube-system/kube-proxy-prdpx
evicting pod default/hello-746c87566d-lpz5c
evicting pod default/simple-webapp-1
evicting pod kube-system/coredns-74ff55c5b-5sw2r
evicting pod default/hello-746c87566d-tqjl9
evicting pod kube-system/coredns-74ff55c5b-dmrzx
evicting pod default/hello-746c87566d-8z7tx
evicting pod default/hello-746c87566d-sdn9x
evicting pod default/hello-746c87566d-s462f
I0109 17:17:09.063593 29626 request.go:645] Throttling request took 1.100657435s, request: GET:https://controlplane:6443/api/v1/namespaces/kube-system/pods/coredns-74ff55c5b-dmrzx
pod/coredns-74ff55c5b-dmrzx evicted
pod/hello-746c87566d-lpz5c evicted
pod/hello-746c87566d-tqjl9 evicted
pod/hello-746c87566d-8z7tx evicted
pod/hello-746c87566d-sdn9x evicted
pod/hello-746c87566d-s462f evicted
pod/coredns-74ff55c5b-5sw2r evicted
pod/simple-webapp-1 evicted
node/node1 evicted

 

Step 17: Verify Node

Then check the status of the node by using kubectl get nodes command as shown below. You can see that node1 is set to SchedulingDisabled status.

root@master:~# kubectl get nodes
NAME   STATUS                   ROLES  AGE VERSION
master Ready                    master 32m v1.20.0
node1  Ready,SchedulingDisabled <none> 32m v1.19.0

 

Step 18: SSH to node1

To proceed with the upgrade, you need to login to node1 by using ssh node1 command as shown below.

root@master:~# ssh node1
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1059-gcp x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
root@node1:~#

 

Step 19: Run Update

In this node also you need to run apt update command to update the system cache with all the latest available packages and updates from the Ubuntu repo.

root@node1:~# apt update
Get:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:1 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [9383 B]
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [52.6 kB]
Get:6 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [25.7 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2489 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [26.8 kB]

 

Step 20: List Available Patches

Once the cache is updated, you can check the available kubeadm version by using apt-cache madison kubeadm command as shown below.

root@node1:~# apt-cache madison kubeadm
kubeadm | 1.23.1-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.23.0-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.5-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.4-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.3-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.2-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.1-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.22.0-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.8-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.7-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.6-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages
kubeadm | 1.21.5-00 | http://apt.kubernetes.io kubernetes-xenial/main amd64 Packages

 

Step 21: Upgrade Kubeadm

Since in our case we are updating kubeadm to version 1.20.0, we will run apt-get install -y --allow-change-held-packages kubeadm=1.20.0-00 command in this node as well as shown below.

root@node1:~# apt-get install -y --allow-change-held-packages kubeadm=1.20.0-00
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following held packages will be changed:
kubeadm
The following packages will be upgraded:
kubeadm
1 upgraded, 0 newly installed, 0 to remove and 49 not upgraded.
Need to get 7707 kB of archives.
After this operation, 111 kB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.20.0-00 [7707 kB]
Fetched 7707 kB in 0s (40.0 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 15013 files and directories currently installed.)
Preparing to unpack .../kubeadm_1.20.0-00_amd64.deb ...
Unpacking kubeadm (1.20.0-00) over (1.19.0-00) ...
Setting up kubeadm (1.20.0-00) ...

 

Step 22: Upgrade Node

Once kubeadm is upgraded, it is time to upgrade the node by using kubeadm upgrade node command as shown below.

root@node1:~# kubeadm upgrade node
[upgrade] Reading configuration from the cluster...
[upgrade] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks
[preflight] Skipping prepull. Not a control plane node.
[upgrade] Skipping phase. Not a control plane node.
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[upgrade] The configuration for this node was successfully updated!
[upgrade] Now you should go ahead and upgrade the kubelet package using your package manager.

 

Step 23: Upgrade Kubelet

Next we need to update the kubelet package to version 1.20.0 by using apt-get install -y --allow-change-held-packages kubelet=1.20.0-00 command as shown below.

root@node1:~# apt-get install -y --allow-change-held-packages kubelet=1.20.0-00
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following held packages will be changed:
kubelet
The following packages will be upgraded:
kubelet
1 upgraded, 0 newly installed, 0 to remove and 49 not upgraded.
Need to get 18.8 MB of archives.
After this operation, 4000 kB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.20.0-00 [18.8 MB]
Fetched 18.8 MB in 0s (49.6 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 15013 files and directories currently installed.)
Preparing to unpack .../kubelet_1.20.0-00_amd64.deb ...
/usr/sbin/policy-rc.d returned 101, not running 'stop kubelet.service'
Unpacking kubelet (1.20.0-00) over (1.19.0-00) ...
Setting up kubelet (1.20.0-00) ...
/usr/sbin/policy-rc.d returned 101, not running 'start kubelet.service'

After successfully updating the package, you need to restart kubelet service by using systemctl restart kubelet command as shown below.

root@node1:~# systemctl restart kubelet

 

Step 24: Go Back to Master

Once node1 is upgraded, press Ctrl+D to get back to Master node.

root@node1:~# logout
Connection to node1 closed.
root@master:~#

 

Step 25: Check the nodes

On the master node, if we check the nodes status by using kubectl get nodes command then we can see that node1 is still in SchedulingDisabled status.

root@master:~# kubectl get nodes
NAME   STATUS                   ROLES  AGE VERSION
master Ready                    master 45m v1.20.0
node1  Ready,SchedulingDisabled <none> 44m v1.20.0

 

Step 26: Uncordon node1

So to bring node1 back to scheduling state, we need to run kubectl uncordon node1 command as shown below. This will inform the cluster that node1 is again ready for hosting the pods.

root@master:~# kubectl uncordon node1
node/node1 uncordoned

 

Step 27: Verify the Nodes

You can finally verify both nodes status by using same kubectl get nodes command. As you can see, both of them are showing in ready state with k8s version 1.20.0. This confirms that our upgradation was successful.

root@master:~# kubectl get nodes
NAME   STATUS ROLES  AGE VERSION
master Ready  master 48m v1.20.0
node1  Ready  <none> 47m v1.20.0

Leave a Comment