The way to upgrade K8S cluster created with kubeadm from version 1.13.0 to 1.13.5
sudo apt update
sudo apt-cache policy kubeadm
sudo apt-mark unhold kubeadm
sudo apt update && sudo apt upgrade
sudo apt-get install kubeadm=1.13.5-00
sudo apt-mark hold kubeadm
Verify that the download works and has the expected version:
sudo kubeadm version
Apply the upgrade by executing the following command:
sudo kubeadm upgrade apply v1.13.5
sudo apt-mark unhold kubelet
sudo apt update && sudo apt upgrade
sudo apt-get install kubelet=1.13.5-00 kubectl=1.13.5-00
Restart the kubelet
sudo systemctl restart kubelet
Upgrade kubeadm on all worker nodes:
sudo apt-mark unhold kubeadm
sudo apt update && sudo apt upgrade
sudo apt-get install kubeadm=1.13.5-00
sudo apt-mark hold kubeadm
Cordon the node, on the Master node, run:
sudo kubectl drain $NODE --ignore-daemonsets
Output:
node/worker-node cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/kube-flannel-ds-amd64-s8j5k, kube-system/kube-proxy-whc6q
evicting pod "coredns-fb8b8dccf-jhlgr"
evicting pod "test-ru-jz5df"
pod/coredns-fb8b8dccf-jhlgr evicted
pod/test-ru-jz5df evicted
node/worker-node evicted
Upgrade the kubelet config on worker node
sudo kubeadm upgrade node config --kubelet-version v1.13.5
Upgrade kubelet and kubectl
sudo apt update && sudo apt upgrade
sudo apt-get install kubelet=1.13.5-00 kubectl=1.13.5-00
Restart the kubelet
sudo systemctl restart kubelet
Uncordon the node, bring the node back online by marking it scheduable
sudo kubectl uncordon $NODE
sudo kubectl get nodes
The result:
NAME STATUS ROLES AGE VERSION
cncf Ready master 172m v1.13.5
worker-node Ready <none> 169m v1.13.5