305-998-7702 | 415-800-2922 info@rx-m.com

Upgrading Kubernetes with Kubeadm

Learn how to put the latest open source technology into practice with hands-on training, delivered by industry experts, aligned to your desired business outcomes

Cluster upgrades involve updating the version of the Kubernetes control plane components and the kubelets that run on every node in the cluster. In general, the API server determines the version of the Kubernetes cluster. The kubelet may be up two minor versions older than the API server. The other control plane components may be up to one minor version older than the API server. The kubectl client may be one version newer or older than the API server.

The details of the version support policy are detailed on the version skew policy page in the Kubernetes documentation.

To upgrade the control-plane node we must do the following:

  • retrieve updated Kubernetes binaries
  • install the newer version of kubadm
  • drain the control plane node
  • use kubeadm upgrade plan to check and fetch the new control plane component versions
  • apply the upgrade
  • upgrade the kubelet and kubectl
  • uncordon the control plan node

The following is an example of upgrading a Kubernetes control plane node from Kubernetes v1.18.0 to v.19.0 on Ubuntu 18.04:

Update the apt repository:

$ sudo apt update
…
$

Install the newer kubeadm version e.g. v1.19.0:

$ sudo apt install kubeadm=1.19.0-00
…
$

Drain the control plan node:

$ kubectl drain  --ignore-daemonsets
…
$

Run kubeadm upgrade plan with sudo to check and fetch updated control plane components:

$ sudo kubeadm upgrade plan
…
Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT              CURRENT         AVAILABLE
kubelet                1 x v1.18.0     v1.19.1

Upgrade to the latest stable version:

COMPONENT                   CURRENT   AVAILABLE
kube-apiserver              v1.18.0   v1.19.1
kube-controller-manager     v1.18.0   v1.19.1
kube-scheduler              v1.18.0   v1.19.1
kube-proxy                  v1.18.0   v1.19.1
CoreDNS                     1.6.7       1.7.0
etcd                        3.4.3-0   3.4.9-1

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

        kubeadm upgrade apply v1.19.1

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

_____________________________________________________________________


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
_____________________________________________________________________

$

Notice that the kubelet must be upgraded manually after upgrading the control plane.

We see that v1.19.1 is available but let’s upgrade to v1.19.0:

$ sudo kubeadm upgrade apply v1.19.0
…
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.19.0". Enjoy!

[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.

$

Install the corresponding versions of the kubelet and kubectl:

$ sudo apt install kubelet=1.19.0-00 kubectl=1.19.0-00
…
Setting up kubelet (1.19.0-00) ...
Setting up kubectl (1.19.0-00) ...

$

Uncordon the control plan node:

$ kubectl uncordon  
node/ uncordoned

$

Learn more about upgrading your cluster with kubeadm