Background:
Upgrade is an ongoing thing: Kubernetes 1.16.15 to 1.17.17, and Kubernetes 1.17.17 to 1.18.20
Cluster configuration:
The host name | system | ip |
---|---|---|
k8s-vip | slb | 10.0.0.37 |
k8s-master-01 | centos7 | 10.0.0.41 |
k8s-master-02 | centos7 | 10.0.0.34 |
k8s-master-03 | centos7 | 10.0.0.26 |
k8s-node-01 | centos7 | 10.0.0.36 |
k8s-node-02 | centos7 | 10.0.0.83 |
k8s-node-03 | centos7 | 10.0.0.40 |
k8s-node-04 | centos7 | 10.0.0.49 |
k8s-node-05 | centos7 | 10.0.0.45 |
k8s-node-06 | centos7 | 10.0.0.18 |
1. Refer to official documentation
Reference: https://kubernetes.io/zh/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/
2. Confirm the upgradable version and upgrade plan
yum list --showduplicates kubeadm --disableexcludes=kubernetes
The latest version of 1.19 is version 1.19.12-0. K8S-master-03 node should be upgraded first according to personal habits
3. Upgrade the K8S-master-03 node control plane
K8S-master-03 is still executed:
1. Yum upgrades the Kubernetes plugin
Yum install kubeadm-1.19.12-0 kubelet-1.19.12-0 kubectl-1.19.12-0 --disableexcludes=kubernetes
2. The vacated node checks whether the cluster can be upgraded
Still considered a refresher drain command:
kubectl drain k8s-master-03 --ignore-daemonsets
sudo kubeadm upgrade plan
3. Upgrade to 1.19.12
Kubeadm upgrade the apply 1.19.12
Note: It is important to note that the versions of the work node are also 1.18.20. There is no need to boast more versions
[root@k8s-master-03 ~]# sudo systemctl daemon-reload
[root@k8s-master-03 ~]# sudo systemctl restart kubelet
[root@k8s-master-03 ~]# kubectl uncordon k8s-master-03
node/k8s-master-03 uncordoned
4. Upgrade other control plane (K8S-master-01 K8S-master-02)
Sudo yum install kubeadm-1.19.12-0 kubelet-1.19.12-0 kubectl-1.19.12-0 --disableexcludes=kubernetes sudo kubeadm upgrade node sudo systemctl daemon-reload sudo systemctl restart kubelet
5. Work node upgrade
Sudo yum install kubeadm-1.19.12-0 kubelet-1.19.12-0 kubectl-1.19.12-0 --disableexcludes=kubernetes sudo kubeadm upgrade node sudo systemctl daemon-reload sudo systemctl restart kubelet
6. Verify the upgrade
kubectl get nodes
7. Other
Take a look at the plugin log under kube-system to make sure the plugin is working properly
kubectl logs -f kube-controller-manager-k8s-master-01 -n kube-system
Visual inspection is to ignore without a problem…. Well, I’ll leave the Prometheus question. I was ready to install the mainline version as well. The past is ready to unload. If the CLUSeterrole problem occurs, please refer to:Kubernetes 1.16.15 was upgraded to 1.17.17