In this blog I will explain how-to upgrade your k8s kubernetes cluster to a newer version. In this example I will upgrade my kubernetes cluster from version 1.23.0 to version 1.23.1. The upgrade procedure is not that difficult. I have upgraded my server from my original version 1.19.2 up to the version 1.23.1 (and all versions in between) with no serious issues.
The upgrade the kubernetes cluster consists of these steps:
1. Upgrade the software on the master server and worker nodes to the latest version
2. Upgrade the deployment of the system containers to the latest version
3. Sometimes with major version upgrades you need to update yaml file format if new or updates API's are introduced or depricated. This is usually announced in a long time in advance. For example the new ingress api with the introduction of kubernetes version 1.22 (see link )
Option 3 doesn't occur that often, but it is always recommended to read the kubernetes blog to get info about the new kubernetest version. Also note that during the upgrade process you will get notified when there are major updates on the API's.
It's always recommended to do a backup before you do an upgrade. You can use velero for kubernetes backups as described in of my previous blog.
So when everything is ready, let's start with the upgrade with step 1.
1. Upgrade the software on the master server and worker nodes to the latest version
Upgrading the software packages on the master and workers nodes is pretty straightforward. This just like upgrade regular linux packages via apt. So start an ssh session to your master and worker nodes and type the following command:
sudo apt update && sudo apt upgrade -y
This command will update the software repositories and upgrade the latest version of all installed packages (like the kubernetes package kubeadm, kubectl and kubelet) on Ubuntu linux we are using on our Raspberry Pi cluster. (see screenshot below).
When we have updated all the software packages on your master and worker nodes, you can check the installed version of kubernetes on your master node via the command.
kubectl get nodes
kubectl version
sudo kubeadm upgrade plan
This command will run a check and will show you what it plans to upgrade on your k8s cluster and provides you with additional info about the upgrade. (see screenshot below)
sudo kubeadm upgrade apply v1.23.1
Now the kubernetes upgrade will start. It will download the latest kubernetes container images and deploy them, just like the screens shots below.
kubectl version
And you shall see that the server part is now also upgraded to version v1.23.1.
I hope you find this blog useful. You can find yaml files en scripts used in my blogs on my github page here
If you have any questions, do not hesitate to leave a comment below.
The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles, Thank you.Paas kubernetes
ReplyDelete