Upgrading a Kubernetes cluster has been made simple with 'kubeadm upgrade' since it does the heavy lifting for you. My setup is fairly simple since it's my homelab with 1 master-node and 2 worker nodes.
In order to upgrade, log in to (one of) your master-node(s) and update the kubernetes packages:
[archy@kube01 ~]$ tmux new -s kubernetes_upgrade
[archy@kube01 ~]$ sudo yum -y update kubeadm kubelet kubectl
Once the packages are updated, you can continue to update using kubeadm
[archy@kube01 ~]$ sudo kubeadm upgrade plan
This will print out the latest version that can be upgraded to. In my case, it is v1.18.8.
First, run a dry-run to see if everything would go well or if there are some errors.
[archy@kube01 ~]$ sudo kubeadm upgrade apply v1.18.8 --dry-run
If everything goes well, run the upgrade.
[archy@kube01 ~]$ sudo kubeadm upgrade apply v1.18.8
Note: this might take a while depending on your resource usage.
Next, drain the worker node and upgrade it.
[archy@kube01 ~]$ kubectl drain kube02.archyslife.lan --ignore-daemonsets
Note: You'll have to log in on to the worker node in order to upgrade the packages.
[archy@kube02 ~]$ sudo yum -y update kubeadm kubelet kubectl
[archy@kube02 ~]$ sudo systemctl daemon-reload
[archy@kube02 ~]$ sudo systemctl restart kubelet.service
Once the kubelet service is up and running again, make the worker node schedulable again. This has to be repeated for every worker node in the cluster.
[archy@kube01 ~]$ kubectl uncordon kube02.archyslife.lan
Feel free to comment and / or suggest a topic
Comments
Post a Comment