Kubernetes实战(十)-升级k8s集群

1 Kubernetes(k8s) 集群升级过程

Kubernetes 使用 kubeadm 工具来管理集群组件的升级。在集群节点层面,升级 Kubernetes(k8s)集群的过程可以分为以下几个步骤:

1)检查当前环境和配置是否满足升级要求。

2)升级master主节点(如果是多master,则master轮着升级)。

3)升级worker工作节点。

4)升级网络插件。

在软件层面,升级 Kubernetes(k8s)集群的过程可以分为以下几个步骤:

1)升级kubeadm

2)节点执行drain操作

3)升级各个组件

4)取消drain操作

5)升级kubelet和kubectl

注意:Kubernetes(k8s)集群升级的时候是不能跨版本升级的,比如:Kubernetes(k8s)集群 1.19.x可以升级为1.20.y,但是Kubernetes(k8s)集群 1.19.x不能直接升级为 1.21.y,只能从一个次版本升级到下一个次版本,或者在次版本相同时升级补丁版本。 也就是说,升级时不可以跳过次版本。 例如,只能从 1.y 升级到 1.y+1,而不能从 1.y 升级到 1.y+2。

2 升级master主节点

2.1 升级kubeadm 

Kubernetes(k8s)集群版本是v1.21.0。

$ kubectl get nodes 
NAME           STATUS   ROLES                  AGE   VERSION
ops-master-1   Ready    control-plane,master   33m   v1.21.0
ops-worker-1   Ready    <none>                 30m   v1.21.0
ops-worker-2   Ready    <none>                 30m   v1.21.0

查看可用的kubeadm版本:

yum list --showduplicates kubeadm --disableexcludes=kubernetes
Loaded plugins: fastestmirror, langpacks, releasever-adapter, update-motd
Loading mirror speeds from cached hostfile
Installed Packages
kubeadm.x86_64                                                                                        1.21.0-0                                                                                          @k8s
Available Packages
kubeadm.x86_64                                                                                        1.6.0-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.1-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.2-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.3-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.4-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.5-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.6-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.7-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.8-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.9-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.6.10-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.6.11-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.6.12-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.6.13-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.7.0-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.1-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.2-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.3-1                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.4-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.5-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.6-1                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.7-1                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.8-1                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.9-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.7.10-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.7.11-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.7.14-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.7.15-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.7.16-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.8.0-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.0-1                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.1-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.2-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.3-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.4-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.5-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.6-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.7-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.8-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.9-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.8.10-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.8.11-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.8.12-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.8.13-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.8.14-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.8.15-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.9.0-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.1-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.2-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.3-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.4-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.5-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.6-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.7-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.8-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.9-0                                                                                           k8s 
kubeadm.x86_64                                                                                        1.9.10-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.9.11-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.10.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.10.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.10.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.10.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.11.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.11.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.12.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.12.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.13.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.13.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.13.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.13.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.14.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.14.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.15.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.15.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.15.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.15.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.16.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.11-1                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.16.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.7-1                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.17.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.16-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.17.17-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.4-1                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.18.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.16-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.17-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.18-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.19-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.18.20-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.19.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.19.16-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.20.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.20.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.20.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.20.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.20.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.20.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.20.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.21.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.21.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.21.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.21.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.21.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.21.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.22.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.16-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.22.17-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.23.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.16-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.23.17-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.24.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.15-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.16-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.24.17-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.25.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.25.10-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.25.11-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.25.12-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.25.13-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.25.14-0                                                                                         k8s 
kubeadm.x86_64                                                                                        1.26.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.7-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.8-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.26.9-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.2-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.3-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.4-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.5-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.27.6-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.28.0-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.28.1-0                                                                                          k8s 
kubeadm.x86_64                                                                                        1.28.2-0                                                                                          k8s 

升级kubeadm到1.21.9-0版本:

$ yum install -y kubeadm-1.21.9-0 --disableexcludes=kubernetes
Loaded plugins: fastestmirror, langpacks, releasever-adapter, update-motd
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.21.0-0 will be updated
---> Package kubeadm.x86_64 0:1.21.9-0 will be an update
--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================================Package                                           Arch                                             Version                                             Repository                                     Size
============================================================================================================================================================================================================
Updating:kubeadm                                           x86_64                                           1.21.9-0                                            k8s                                           9.1 MTransaction Summary
============================================================================================================================================================================================================
Upgrade  1 PackageTotal download size: 9.1 M
Downloading packages:
No Presto metadata available for k8s
f41c806d2113e9b88efd9f70e3a07da3cd0597f5361f7842058e06b9601ff7fc-kubeadm-1.21.9-0.x86_64.rpm                                                                                         | 9.1 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionUpdating   : kubeadm-1.21.9-0.x86_64                                                                                                                                                                  1/2 Cleanup    : kubeadm-1.21.0-0.x86_64                                                                                                                                                                  2/2 Verifying  : kubeadm-1.21.9-0.x86_64                                                                                                                                                                  1/2 Verifying  : kubeadm-1.21.0-0.x86_64                                                                                                                                                                  2/2 Updated:kubeadm.x86_64 0:1.21.9-0                                                                                                                                                                                 Complete!

kubeadm upgrade plan验证升级计划,COMPONENT CURRENT TARGET :告诉我们组件可以从当前版本升级到的版本。

$ kubeadm upgrade plan
kubeadm upgrade plan
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.21.0
[upgrade/versions] kubeadm version: v1.21.9
I1210 20:34:17.564937    5980 version.go:254] remote version is much newer: v1.28.4; falling back to: stable-1.21
[upgrade/versions] Target version: v1.21.14
[upgrade/versions] Latest version in the v1.21 series: v1.21.14Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT   CURRENT       TARGET
kubelet     3 x v1.21.0   v1.21.14Upgrade to the latest version in the v1.21 series:COMPONENT                 CURRENT    TARGET
kube-apiserver            v1.21.0    v1.21.14
kube-controller-manager   v1.21.0    v1.21.14
kube-scheduler            v1.21.0    v1.21.14
kube-proxy                v1.21.0    v1.21.14
CoreDNS                   v1.8.0     v1.8.0
etcd                      3.4.13-0   3.4.13-0You can now apply the upgrade by executing the following command:kubeadm upgrade apply v1.21.14Note: Before you can perform this upgrade, you have to update kubeadm to v1.21.14._____________________________________________________________________The table below shows the current state of component configs as understood by this version of kubeadm.
Configs that have a "yes" mark in the "MANUAL UPGRADE REQUIRED" column require manual config upgrade or
resetting to kubeadm defaults before a successful upgrade can be performed. The version to manually
upgrade to is denoted in the "PREFERRED VERSION" column.API GROUP                 CURRENT VERSION   PREFERRED VERSION   MANUAL UPGRADE REQUIRED
kubeproxy.config.k8s.io   v1alpha1          v1alpha1            no
kubelet.config.k8s.io     v1beta1           v1beta1             no
_____________________________________________________________________

2.2 升级各个组件

上一步是升级kubeadm ,接下来升级各个组件(kube-apiserver,kube-controller-manager等等),

kubeadm upgrade apply v1.21.9升级各个组件到1.21.9版本,如果etcd这个组件不想升级,可以加上选项:kubeadm upgrade apply v1.21.9 --etcd-upgrade=false。

可以提前drain节点,后面drain也可以。

腾空节点:通过将节点标记为不可调度并腾空节点为节点作升级准备:kubectl drain --ignore-daemonsets。

$ kubectl drain ops-master-1 --ignore-daemonsets
node/k8scloude1 cordoned
error: unable to drain node "k8scloude1", aborting command...There are pending nodes to be drained:k8scloude1
error: cannot delete Pods with local storage (use --delete-emptydir-data to override): kube-system/metrics-server-bcfb98c76-j4gs8, kubernetes-dashboard/dashboard-metrics-scraper-7f458d9467-9knf9

因为有本地数据,需要加--delete-emptydir-data选项。

$ kubectl drain ops-master-1 --ignore-daemonsets --delete-emptydir-data 
node/ops-master-1 already cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-whfb8, kube-system/kube-proxy-srhgz
node/ops-master-1 drained

升级各个组件,--etcd-upgrade=false表示etcd数据库不升级。

$ kubeadm upgrade apply v1.21.9 --etcd-upgrade=false
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade/version] You have chosen to change the cluster version to "v1.21.9"
[upgrade/versions] Cluster version: v1.21.0
[upgrade/versions] kubeadm version: v1.21.9
[upgrade/confirm] Are you sure you want to proceed with the upgrade? [y/N]: y
[upgrade/prepull] Pulling images required for setting up a Kubernetes cluster
[upgrade/prepull] This might take a minute or two, depending on the speed of your internet connection
[upgrade/prepull] You can also perform this action in beforehand using 'kubeadm config images pull'
[upgrade/apply] Upgrading your Static Pod-hosted control plane to version "v1.21.9"...
Static pod: kube-apiserver-ops-master-1 hash: 94a1393eb20a9652cea984f5907ed147
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
[upgrade/staticpods] Writing new Static Pod manifests to "/etc/kubernetes/tmp/kubeadm-upgraded-manifests053748490"
[upgrade/staticpods] Preparing for "kube-apiserver" upgrade
[upgrade/staticpods] Renewing apiserver certificate
[upgrade/staticpods] Renewing apiserver-kubelet-client certificate
[upgrade/staticpods] Renewing front-proxy-client certificate
[upgrade/staticpods] Renewing apiserver-etcd-client certificate
[upgrade/staticpods] Moved new manifest to "/etc/kubernetes/manifests/kube-apiserver.yaml" and backed up old manifest to "/etc/kubernetes/tmp/kubeadm-backup-manifests-2023-12-10-20-38-23/kube-apiserver.yaml"
[upgrade/staticpods] Waiting for the kubelet to restart the component
[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s)
Static pod: kube-apiserver-ops-master-1 hash: 94a1393eb20a9652cea984f5907ed147
Static pod: kube-apiserver-ops-master-1 hash: 94a1393eb20a9652cea984f5907ed147
Static pod: kube-apiserver-ops-master-1 hash: 26e768b6e5881ba632db749b44ed30c5
[apiclient] Found 1 Pods for label selector component=kube-apiserver[upgrade/staticpods] Component "kube-apiserver" upgraded successfully!
[upgrade/staticpods] Preparing for "kube-controller-manager" upgrade
[upgrade/staticpods] Renewing controller-manager.conf certificate
[upgrade/staticpods] Moved new manifest to "/etc/kubernetes/manifests/kube-controller-manager.yaml" and backed up old manifest to "/etc/kubernetes/tmp/kubeadm-backup-manifests-2023-12-10-20-38-23/kube-controller-manager.yaml"
[upgrade/staticpods] Waiting for the kubelet to restart the component
[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s)
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: dfcbd862b8c83e8fbd17b289c6d2d47b
Static pod: kube-controller-manager-ops-master-1 hash: 0074b909bb20d0a0ab9caa7f07b66191
[apiclient] Found 1 Pods for label selector component=kube-controller-manager
[upgrade/staticpods] Component "kube-controller-manager" upgraded successfully!
[upgrade/staticpods] Preparing for "kube-scheduler" upgrade
[upgrade/staticpods] Renewing scheduler.conf certificate
[upgrade/staticpods] Moved new manifest to "/etc/kubernetes/manifests/kube-scheduler.yaml" and backed up old manifest to "/etc/kubernetes/tmp/kubeadm-backup-manifests-2023-12-10-20-38-23/kube-scheduler.yaml"
[upgrade/staticpods] Waiting for the kubelet to restart the component
[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s)
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: f77a726558e477a8bc7504218c9d2ccd
Static pod: kube-scheduler-ops-master-1 hash: 07614ccea2a58fd20ecb645d2901f0c9
[apiclient] Found 1 Pods for label selector component=kube-scheduler
[upgrade/staticpods] Component "kube-scheduler" upgraded successfully!
[upgrade/postupgrade] Applying label node-role.kubernetes.io/control-plane='' to Nodes with label node-role.kubernetes.io/master='' (deprecated)
[upgrade/postupgrade] Applying label node.kubernetes.io/exclude-from-external-load-balancers='' to control plane Nodes
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.21" in namespace kube-system with the configuration for the kubelets in the cluster
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.21.9". Enjoy![upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.

现在ops-master-1节点是不可调度状态的。

$ kubectl get node
NAME           STATUS                     ROLES                  AGE   VERSION
ops-master-1   Ready,SchedulingDisabled   control-plane,master   49m   v1.21.0
ops-worker-1   Ready                      <none>                 46m   v1.21.0
ops-worker-2   Ready                      <none>                 46m   v1.21.0

解除ops-master-1节点的保护:通过将节点标记为可调度,让其重新上线。

$ kubectl uncordon ops-master-1
node/ops-master-1 uncordoned

现在ops-master-1节点是Ready状态的。

$ kubectl get node
NAME           STATUS   ROLES                  AGE   VERSION
ops-master-1   Ready    control-plane,master   53m   v1.21.0
ops-worker-1   Ready    <none>                 50m   v1.21.0
ops-worker-2   Ready    <none>                 50m   v1.21.0

 2.2 升级 kubelet 和 kubectl

升级 kubelet 和 kubectl到1.21.9版本。

$ yum install -y kubelet-1.21.9-0 kubectl-1.21.9-0 --disableexcludes=kubernetes

重新加载配置文件并重启 kubelet。

$ systemctl daemon-reload ;systemctl restart kubelet

此时op-master-1节点的版本就变为v1.21.9了,k8s集群的master节点升级成功,如果有多个master,则步骤一样,但是第二个master节点不需要执行kubeadm upgrade apply v1.21.9命令,第二台master节点把kubeadm upgrade apply v1.21.9变为kubeadm upgrade node

$ kubectl get node
NAME           STATUS   ROLES                  AGE    VERSION
ops-master-1   Ready    control-plane,master   143m   v1.21.9
ops-worker-1   Ready    <none>                 140m   v1.21.0
ops-worker-2   Ready    <none>                 140m   v1.21.0

3 升级worker工作节点

3.1 升级kubeadm

$ yum install -y kubeadm-1.21.9-0 --disableexcludes=kubernetes

通过将节点标记为不可调度并腾空节点,为节点作升级准备。 

如果本地有数据,建议使用--delete-emptydir-data选项。

$ kubectl drain ops-worker-1 --ignore-daemonsets
node/ops-worker-1 cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-g6ntb, kube-system/kube-proxy-nf2rm
evicting pod kube-system/coredns-59d64cd4d4-qf9rx
pod/coredns-59d64cd4d4-qf9rx evicted
node/ops-worker-1 evicted
kubectl get node
NAME           STATUS                     ROLES                  AGE    VERSION
ops-master-1   Ready                      control-plane,master   144m   v1.21.9
ops-worker-1   Ready,SchedulingDisabled   <none>                 141m   v1.21.0
ops-worker-2   Ready                      <none>                 141m   v1.21.0

对于工作节点, kubeadm upgrade node 命令会升级本地的 kubelet 配置。

$ kubeadm upgrade node
[upgrade] Reading configuration from the cluster...
[upgrade] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks
[preflight] Skipping prepull. Not a control plane node.
[upgrade] Skipping phase. Not a control plane node.
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[upgrade] The configuration for this node was successfully updated!
[upgrade] Now you should go ahead and upgrade the kubelet package using your package manager.

通过将ops-worker-1节点标记为可调度,让其重新上线。 

$ kubectl uncordon ops-worker-1
node/ops-worker-1 uncordoned
$ kubectl get nodes
NAME           STATUS   ROLES                  AGE    VERSION
ops-master-1   Ready    control-plane,master   145m   v1.21.9
ops-worker-1   Ready    <none>                 142m   v1.21.0
ops-worker-2   Ready    <none>                 142m   v1.21.0

3.2 升级kubelet和kubectl

升级kubelet和kubectl到1.21.9版本。

 

$ yum install -y kubelet-1.21.9-0 kubectl-1.21.9-0 --disableexcludes=kubernetes
Loaded plugins: fastestmirror, langpacks, releasever-adapter, update-motd
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package kubectl.x86_64 0:1.21.0-0 will be updated
---> Package kubectl.x86_64 0:1.21.9-0 will be an update
---> Package kubelet.x86_64 0:1.21.0-0 will be updated
---> Package kubelet.x86_64 0:1.21.9-0 will be an update
--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================================Package                                           Arch                                             Version                                             Repository                                     Size
============================================================================================================================================================================================================
Updating:kubectl                                           x86_64                                           1.21.9-0                                            k8s                                           9.6 Mkubelet                                           x86_64                                           1.21.9-0                                            k8s                                            20 MTransaction Summary
============================================================================================================================================================================================================
Upgrade  2 PackagesTotal download size: 30 M
Downloading packages:
No Presto metadata available for k8s
(1/2): f53d5be18ac04fa2eebe0f27a984fbc1197a31f1ed4e92c3762f0f584fcd502c-kubectl-1.21.9-0.x86_64.rpm                                                                                  | 9.6 MB  00:00:00     
(2/2): 6e68c2e2eb926e163f53a7d64000334c6cae982841fffee350f5003793a63a9c-kubelet-1.21.9-0.x86_64.rpm                                                                                  |  20 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                        28 MB/s |  30 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionUpdating   : kubelet-1.21.9-0.x86_64                                                                                                                                                                  1/4 Updating   : kubectl-1.21.9-0.x86_64                                                                                                                                                                  2/4 Cleanup    : kubectl-1.21.0-0.x86_64                                                                                                                                                                  3/4 Cleanup    : kubelet-1.21.0-0.x86_64                                                                                                                                                                  4/4 Verifying  : kubectl-1.21.9-0.x86_64                                                                                                                                                                  1/4 Verifying  : kubelet-1.21.9-0.x86_64                                                                                                                                                                  2/4 Verifying  : kubelet-1.21.0-0.x86_64                                                                                                                                                                  3/4 Verifying  : kubectl-1.21.0-0.x86_64                                                                                                                                                                  4/4 Updated:kubectl.x86_64 0:1.21.9-0                                                                            kubelet.x86_64 0:1.21.9-0                                                                           Complete!

重新加载配置文件并重启kubelet。

$ systemctl daemon-reload ;systemctl restart kubelet
systemctl daemon-reload ;systemctl restart kubelet
$ kubectl get nodes
NAME           STATUS   ROLES                  AGE    VERSION
ops-master-1   Ready    control-plane,master   145m   v1.21.9
ops-worker-1   Ready    <none>                 142m   v1.21.9
ops-worker-2   Ready    <none>                 142m   v1.21.0

节点ops-worker-2升级步骤和ops-worker-1节点一模一样。

等节点ops-worker-2升级完成后,整个Kubernetes(k8s) 集群就升级完毕了,版本都是v1.21.9。

$ kubectl get nodes
NAME           STATUS   ROLES                  AGE    VERSION
ops-master-1   Ready    control-plane,master   147m   v1.21.9
ops-worker-1   Ready    <none>                 144m   v1.21.9
ops-worker-2   Ready    <none>                 144m   v1.21.9

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/212840.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何一个例子玩明白GIT

一个例子玩明白GIT GIT的介绍和教程五花八门&#xff0c;但实际需要用的就是建仓、推送、拉取等操作&#xff0c;这儿咱可以通过一个例子熟悉这些操作&#xff0c;一次性搞定GIT的使用方法学习。下面这个例子的内容是内容是建立初始版本库&#xff0c;然后将数据复制到 "远…

轻量封装WebGPU渲染系统示例<45>- 材质组装流水线(MaterialPipeline)灯光、阴影、雾(源码)

当前示例源码github地址: https://github.com/vilyLei/voxwebgpu/blob/feature/material/src/voxgpu/sample/MaterialPipelineFog.ts 当前示例运行效果: 此示例基于此渲染系统实现&#xff0c;当前示例TypeScript源码如下&#xff1a; export class MaterialPipelineFog {pr…

数组创建方法

数组的创建 1.let a[] 2.let anew Array(5) 3.let anew Array(1,2,3) 4.let a[1,2,3] 创建数组是空还是有值是以上四种写法。但是如果没给值的变量是undefined&#xff0c;再a[0]找不到这种变量的。所以当找某一个数需要已经是数组内存。不想给值可以给空数组。只要是数组…

MEMS制造的基本工艺介绍——晶圆键合

晶圆键合是一种晶圆级封装技术&#xff0c;用于制造微机电系统 (MEMS)、纳米机电系统 (NEMS)、微电子学和光电子学&#xff0c;确保机械稳定和气密密封。用于 MEMS/NEMS 的晶圆直径范围为 100 毫米至 200 毫米&#xff08;4 英寸至 8 英寸&#xff09;&#xff0c;用于生产微电…

【重点】【环链表入口】142. 环形链表 II

题目 public class Solution {public ListNode detectCycle(ListNode head) {if (head null || head.next null) {return null;}ListNode slow head, fast head;while (fast ! null && fast.next ! null) {slow slow.next;fast fast.next.next;if (slow fast) …

SQL语句---更新数据

介绍 使用sql语句更新数据。 命令 update 表名 set 字段1值1[,字段2值2] [where 条件表达式];[]&#xff08;方括号&#xff09;内的表是表示可选。 例子 将a表id值等于1的数据的名称改为666 update a set name666 where id1;

2023-12-05 Qt学习总结7

点击 <C 语言编程核心突破> 快速C语言入门 Qt学习总结 前言二十 QTcpSocket QTcpServer网络库服务端代码:客户端代码 二十一 QProcess进程类二十二 QThread线程总结 前言 要解决问题: 学习qt最核心知识, 多一个都不学. 二十 QTcpSocket QTcpServer网络库 QTcpSocket和…

持续集成交付CICD:Jenkins流水线实现Nexus制品晋级策略

目录 一、理论 1.开发测试运维环境 二、实验 1.Nexus制品晋级策略 一、理论 1.开发测试运维环境 &#xff08;1&#xff09;环境 1&#xff09;持续集成开发环境&#xff08;DEV: Development Environment&#xff09; 直接通过源代码编译打包&#xff0c;其会跑单元测试…

python 笔记 :trajectory_distance包(如何可以正确使用)【debug篇】

包的地址&#xff1a;maikol-solis/trajectory_distance (github.com) 1 模块介绍 用Cython实现的Python模块&#xff0c;用于计算二维轨迹之间的距离 trajectory_distance包提供了9种轨迹间的距离计算方法&#xff1a; SSPD&#xff08;对称线段路径距离&#xff09;OWD&a…

机器学习算法(9)——集成技术(Bagging——随机森林分类器和回归)

一、说明 在这篇文章&#xff0c;我将向您解释集成技术和著名的集成技术之一&#xff0c;它属于装袋技术&#xff0c;称为随机森林分类器和回归。 集成技术是机器学习技术&#xff0c;它结合多个基本模块和模型来创建最佳预测模型。为了更好地理解这个定义&#xff0c;我们需要…

WLAN配置实验

本文记录了WLAN配置实践的过程&#xff0c;该操作在华为HCIA中属于相对较复杂的实验&#xff0c;记录过程备忘。这里不就WLAN原理解释&#xff0c;仅进行配置实践&#xff0c;可以作为学习原理时候的参考。本文使用华为ENSP进行仿真。实验拓扑图如下&#xff1a; 1.WLAN工作流程…

【electron】外语函数接口 FFI

▒ 目录 ▒ &#x1f6eb; 导读需求开发环境 1️⃣ FFI概念优点注意事项 2️⃣ 【废弃】node-ffi3️⃣ node-ffi-napi安装&#xff08;windows系统下&#xff09;示例&#xff1a;MessageBoxA、NtSuspendProcess 4️⃣ node-win32-api安装示例&#xff1a;查找窗口并设置窗口标…

UE5数据传递-纹理贴图

期待结果&#xff1a; 流程 1. 通过C写入数据到纹理贴图 2. 在材质中通过采样能正确读取写入的数值 踩坑&#xff1a; 1. UE5之后&#xff0c;需要设置采样类型&#xff0c;才能达到上图效果&#xff0c;默认采样类型做了插值计算 FColor中写入 PF_B8G8R8A8 UTexture2D* Conve…

第四题:憧憬(JavaPythonC++实现)【第六届传智杯-新增场次-程序设计挑战赛解题分析详解复盘】

本文仅为【2023传智杯-第二场】第六届传智杯程序设计挑战赛-题目解题分析详解的解题个人笔记,个人解题分析记录。 本文包含:第六届传智杯程序设计挑战赛题目、解题思路分析、解题代码、解题代码详解(Java&Python&C++实现) 文章目录 更新进度记录第四题:憧憬(Java…

AI 绘画 | Stable Diffusion 艺术二维码制作

前言 这篇文章教会你如果用Stable Diffusion WEB UI制作艺术二维码,什么是艺术二维码呢?就是普通二维码和艺术图片融合后的二维码图片,如下图所示。主要原理还是使用controlNet的control_v1p_sd15_qrcode_monster模型和光影模型control_v1p_sd15_brightness。 教程 准备…

【论文阅读笔记】NeRF+Mip-NeRF+Instant-NGP

目录 前言NeRF神经辐射场体渲染连续体渲染体渲染离散化 方法位置编码分层采样体渲染推导公式&#xff08;1&#xff09;到公式&#xff08;2&#xff09;部分代码解读相机变换&#xff08;重要&#xff01;&#xff09; Mip-NerfTo do Instant-NGPTo do 前言 NeRF是NeRF系列的…

DIP——边缘提取与分割

1.使用canny算法进行边缘提取 本实验比较简单&#xff0c;基本思路是对原图像进行一个高斯模糊处理&#xff0c;用于去噪&#xff0c;之后转换为灰度图&#xff0c;直接调用cv库中的canny记性边缘提取。若想直接得到彩色边缘&#xff0c;则通过按位与操作&#xff0c;将原始彩色…

SQLMap进阶使用

预计更新SQL注入概述 1.1 SQL注入攻击概述 1.2 SQL注入漏洞分类 1.3 SQL注入攻击的危害 SQLMap介绍 2.1 SQLMap简介 2.2 SQLMap安装与配置 2.3 SQLMap基本用法 SQLMap进阶使用 3.1 SQLMap高级用法 3.2 SQLMap配置文件详解 3.3 SQLMap插件的使用 SQL注入漏洞检测 4.1 SQL注入…

ingress介绍和ingress通过LoadBalancer暴露服务配置

目录 一.ingress基本原理介绍 1.将原有用于暴露服务和负载均衡的服务的三四层负载均衡变为一个七层负载均衡 2.controller和ingress 3.通过下面这个图可能会有更直观的理解 二.为什么会出现ingress 1.NodePort存在缺点 2.LoadBalancer存在缺点 三.ingress三种暴露服务的…

7-6 通讯录排序

输入n个朋友的信息&#xff0c;包括姓名、生日、电话号码&#xff0c;本题要求编写程序&#xff0c;按照年龄从大到小的顺序依次输出通讯录。题目保证所有人的生日均不相同。 输入格式: 输入第一行给出正整数n&#xff08;<10&#xff09;。随后n行&#xff0c;每行按照“…