by Anish
Posted on Thursday April 23, 2020
This page explains how to upgrade a Kubernetes cluster created with kubeadm from version 1.14.x to version 1.15.x, and from version 1.15.x to 1.18.y
The upgrade workflow at high level is the following:
The Setup
The kubernetes cluster is running with 1- Master and 1 Worker node with the v1.14.0
our traget is get this cluster to v1.18.2
version. The enviroment is running on ubuntu platform, for centos family only the repository will chnage the concept will remain the same.
master $ kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 73m v1.14.0
node01 Ready <none> 72m v1.14.0
master $ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:45:25Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
master $ kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:51:21Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
master $
node01 $ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
node01 $ kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:51:21Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
node01 $
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.15.11-00 && \
apt-mark hold kubeadm
kubeadm upgrade plan
kubeadm upgrade apply v1.15.11
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.15.11-00 kubectl=1.15.11-00 && \
apt-mark hold kubelet kubectl
systemctl restart kubelet
kubectl drain node01 --ignore-daemonsets --delete-local-data
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.15.11-00 kubectl=1.15.11-00 && \
apt-mark hold kubelet kubectl
systemctl restart kubelet
kubectl uncordon node01
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.16.9-00 && \
apt-mark hold kubeadm
kubeadm upgrade plan
kubeadm upgrade apply v1.16.9
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.16.9-00 kubectl=1.16.9-00 && \
apt-mark hold kubelet kubectl
systemctl restart kubelet
kubectl drain node01 --ignore-daemonsets --delete-local-data
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubeadm=1.16.9-00 kubeadm=1.16.9-00 && \
apt-mark hold kubelet kubectl
kubeadm upgrade node
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.16.9-00 kubectl=1.16.9-00 && \
apt-mark hold kubelet kubectl
systemctl restart kubelet
kubectl uncordon node01
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.17.5-00 && \
apt-mark hold kubeadm
# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.17.5-00
kubeadm upgrade plan
kubeadm upgrade apply v1.17.5
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.17.5-00 kubectl=1.17.5-00 && \
apt-mark hold kubelet kubectl
systemctl restart kubelet
kubectl drain node01 --ignore-daemonsets --delete-local-data
# replace x in 1.17.x-00 with the latest patch version
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.17.5-00 && \
apt-mark hold kubeadm
# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.17.5-00
# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.17.5-00
kubeadm upgrade node
# replace x in 1.17.x-00 with the latest patch version
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.17.5-00 kubectl=1.17.5-00 && \
apt-mark hold kubelet kubectl
# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.17.5-00 kubectl=1.17.5-00
systemctl restart kubelet
kubectl uncordon node01
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.2-00 && \
apt-mark hold kubeadm
# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.18.2-00
kubeadm upgrade plan
kubeadm upgrade apply v1.18.2
# replace x in 1.18.x-00 with the latest patch version
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.18.2-00 kubectl=1.18.2-00 && \
apt-mark hold kubelet kubectl
# since apt-get version 1.1 you can also use the following method
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.18.2-00 kubectl=1.18.2-00
systemctl restart kubelet
kubectl drain node01 --ignore-daemonsets --delete-local-data
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.18.2-00 && \
apt-mark hold kubeadm
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.18.2-00 kubectl=1.18.2-00 && \
apt-mark hold kubelet kubectl
systemctl restart kubelet
kubectl uncordon node01
since it's kubernetes you may encounter some issues, feel free to poke me
Video Demo for Ubuntu v1.14-v1.18
Video Demo for RHEL
Thanku for reading !!! Give a Share for Support
Instead of directly asking for donations, I'm thrilled to offer you all nine of my books for just $9 on leanpub By grabbing this bundle you not only help cover my coffee, beer, and Amazon bills but also play a crucial role in advancing and refining this project. Your contribution is indispensable, and I'm genuinely grateful for your involvement in this journey!
Any private key value that you enter or we generate is not stored on this site, this tool is provided via an HTTPS URL to ensure that private keys cannot be stolen, for extra security run this software on your network, no cloud dependency