[Master node] upgrade control-plan v1.16.12 > v1.17.17 (CentOS)

Thanaphat Nuangjumnong
3 min readJan 18, 2021

--

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

1.Add Kubernetes Repository

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

2.Find the latest stable 1.17 version:

yum list --showduplicates kubeadm --disableexcludes=kubernetes
# find the latest 1.17 version in the list
# it should look like 1.17.x-0, where x is the latest patch

3.Upgrade the first control plane node

# replace x in 1.17.x-0 with the latest patch version
yum install -y kubeadm-1.17.17-0 --disableexcludes=kubernetes

4.Verify that the download works and has the expected version

$kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.17", GitCommit:"f3abc15296f3a3f54e4ee42e830c61047b13895f", GitTreeState:"clean", BuildDate:"2021-01-13T13:18:52Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

5.On the control plane node, run:

kubeadm upgrade plan

6.Review kubeadm plan

Upgrade to the latest version in the v1.16 series:
COMPONENT CURRENT AVAILABLE
API Server v1.16.0 v1.17.0
Controller Manager v1.16.0 v1.17.0
Scheduler v1.16.0 v1.17.0
Kube Proxy v1.16.0 v1.17.0
CoreDNS 1.6.2 1.6.5
Etcd 3.3.15 3.4.3-0
You can now apply the upgrade by executing the following command:
kubeadm upgrade apply v1.17.17

7.Choose a version to upgrade to, and run the appropriate command. For example:

sudo kubeadm upgrade apply v1.17.17

8.Drain the control plane node

kubectl drain <cp-node-name> --ignore-daemonsets

9.Upgrade kubelet and kubectl

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

10.Restart the kubelet

sudo systemctl restart kubelet

11.Verify kubelet/kubectl version

$kubelet --version
Kubernetes v1.17.17
$kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.17", GitCommit:"f3abc15296f3a3f54e4ee42e830c61047b13895f", GitTreeState:"clean", BuildDate:"2021-01-13T13:21:12Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.17", GitCommit:"f3abc15296f3a3f54e4ee42e830c61047b13895f", GitTreeState:"clean", BuildDate:"2021-01-13T13:13:00Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

12.Uncordon the control plane node

# replace <cp-node-name> with the name of your control plane node
kubectl uncordon <cp-node-name>

13.Verify the status of the cluster

After the kubelet is upgraded on all nodes verify that all nodes are available again by running the following command from anywhere kubectl can access the cluster:

kubectl get nodes
kubectl get pod -n kube-system

The STATUS column should show Ready for all your nodes, and the version number should be updated.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response