kairen / kubeadm-ansible

Build a Kubernetes cluster using kubeadm via Ansible.
Apache License 2.0
724 stars 379 forks source link

Kubernetes upgrade #69

Open tuxpeople opened 5 years ago

tuxpeople commented 5 years ago

I changed the Kubernetes version from 1.14.0 to 1.16.0 after I ran the playbook for the first time and then re-run it. It ran trough and updated the packages like this:

TASK [commons/pre-install : Install kubernetes packages (RHEL/CentOS)] ******************************************************************************************************************************************************************************************************************
Friday 27 September 2019  16:26:28 +0200 (0:00:00.295)       0:01:25.410 ******
changed: [172.16.202.130] => (item=['kubelet-1.16.0', 'kubeadm-1.16.0', 'kubectl-1.16.0'])

But it did not take care of upgrading the configuration, kubectl still shows me 1.14.0 for all nodes. It works like this: https://v1-15.docs.kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade-1-15/

From sudo kubeadm upgrade plan on the master, one can get the available version to upgrade to. Upgrade then the first master node like this: sudo kubeadm upgrade apply <NEWVERSION>. Once this is done, every additional master node needs sudo kubeadm upgrade node. Do not forget to restart Kubelet.

As for the worker nodes, do (one node after another):

kubectl drain $NODE --ignore-daemonsets
sudo kubeadm upgrade node
sudo systemctl restart kubelet
kubectl uncordon $NODE

I'm afraid, I've currently not enough time to implement this myself.