二进制部署K8s集群第24节平滑切换版本技巧

网友投稿 294 2022-10-27

二进制部署K8s集群第24节平滑切换版本技巧

1.1 升级方法

1 一台服务器操作完成切换,再操作第二台、第三台...

2、删除一台node节点

3、关闭升级机器负载匀衡

4、删除老版本软链接,新版本做软链接

5、拷贝老版本重启脚本证书到新软版本软件目录

6、重启kubelet、kube-scheduler、kube-apiserver、kube-proxy、kube-controller-manager

1.2 删除Node节点

hdss7-21执行

[root@hdss7-21 opt]# kubectl get nodes -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME hdss7-21.host.com Ready 3d7h v1.19.2 10.4.7.21 CentOS Linux 7 (Core) 3.10.0-1127.el7.x86_64 docker://19.3.13 hdss7-22.host.com Ready master 3d7h v1.19.2 10.4.7.22 CentOS Linux 7 (Core) 3.10.0-1127.el7.x86_64 [root@hdss7-21 opt]# kubectl delete nodes hdss7-21.host.com node "hdss7-21.host.com" deleted [root@hdss7-21 opt]# kubectl get nodes NAME STATUS ROLES AGE VERSION hdss7-22.host.com Ready master 3d7h v1.19.2

1.3 注释反代

hdss7-11和hdss7-12执行

[root@hdss7-11 ~]# grep -w " server 10.4.7.21:6443" /etc/nginx/nginx.conf # server 10.4.7.21:6443 max_fails=3 fail_timeout=30s; nginx -s reload

1.4 切目录重启

hdss7-21执行

[root@hdss7-21 ~]# mkdir /opt/net_version;cd /opt/net_version; [root@hdss7-21 new_version]# ll 总用量 434140 -rw-r--r-- 1 root root 444555407 10月 8 2020 kubernetes-server-linux-amd64.tar.gz tar xf kubernetes-server-linux-amd64.tar.gz [root@hdss7-21 new_version]# ll 总用量 434140 drwxr-xr-x 4 root root 79 5月 6 13:55 kubernetes -rw-r--r-- 1 root root 444555407 10月 8 2020 kubernetes-server-linux-amd64.tar.gz [root@hdss7-21 new_version]# mv kubernetes /opt/kubernetes-v1.15.12 [root@hdss7-21 new_version]# cd /opt/kubernetes-v1.15.12/ [root@hdss7-21 kubernetes-v1.15.12]# rm -rf kubernetes-src.tar.gz [root@hdss7-21 kubernetes-v1.15.12]# cd server/bin [root@hdss7-21 bin]# rm -f *.tar *_tag [root@hdss7-21 bin]# cp -rf /opt/kubernetes-v1.19.2/server/bin/conf . [root@hdss7-21 bin]# cp -rf /opt/kubernetes-v1.19.2/server/bin/certs . [root@hdss7-21 bin]# cp /opt/kubernetes-v1.19.2/server/bin/kubelet.sh . [root@hdss7-21 opt]# ln -sf /opt/kubernetes-v1.15.12 /opt/kubernetes [root@hdss7-21 opt]# supervisorctl stop kube-apiserver-7-21 kube-controller-manager-7-21 kube-proxy-7-21 kube-scheduler-7-21 [root@hdss7-21 opt]# supervisorctl status kube-apiserver-7-21 kube-controller-manager-7-21 kube-proxy-7-21 kube-scheduler-7-21 kube-apiserver-7-21 STOPPED Oct 06 08:01 AM kube-controller-manager-7-21 STOPPED Oct 06 08:02 AM kube-proxy-7-21 STOPPED Oct 06 08:02 AM kube-scheduler-7-21 STOPPED Oct 06 08:02 AM [root@hdss7-21 opt]# supervisorctl start kube-apiserver-7-21 kube-controller-manager-7-21 kube-proxy-7-21 kube-scheduler-7-21 kube-kubelet-7-21 [root@hdss7-21 bin]# supervisorctl status etcd-server-7-21 RUNNING pid 36332, uptime 2 days, 17:43:39 flanneld-7-21 RUNNING pid 130301, uptime 2 days, 12:33:31 kube-apiserver-7-21 RUNNING pid 63354, uptime 0:09:44 kube-controller-manager-7-21 RUNNING pid 63378, uptime 0:09:13 kube-kubelet-7-21 FATAL Exited too quickly (process log may have details) kube-proxy-7-21 RUNNING pid 63398, uptime 0:08:43 kube-scheduler-7-21 RUNNING pid 63522, uptime 0:08:12

1.5 开启Kubelet报错

估计是关闭kubelet没关好

看启动报错日志提示删除文件再重启 Please drain this node and delete the CPU manager checkpoint file "/data/kubelet/cpu_manager_state" before restarting Kubelet. F1006 08:07:22.483670 62266 server.go:273] failed to run Kubelet: could not initialize checkpoint manager: could not restore state from checkpoint: checkpoint is corrupted Please drain this node and delete the CPU manager checkpoint file "/data/kubelet/cpu_manager_state" before restarting K [root@hdss7-21 bin]# rm -rf /data/kubelet/cpu_manager_state [root@hdss7-21 bin]# supervisorctl start kube-kubelet-7-21 [root@hdss7-21 bin]# supervisorctl status etcd-server-7-21 RUNNING pid 36332, uptime 2 days, 17:44:39 flanneld-7-21 RUNNING pid 130301, uptime 2 days, 12:34:31 kube-apiserver-7-21 RUNNING pid 63354, uptime 0:10:44 kube-controller-manager-7-21 RUNNING pid 63378, uptime 0:10:13 kube-kubelet-7-21 RUNNING pid 65092, uptime 0:00:37 kube-proxy-7-21 RUNNING pid 63398, uptime 0:09:43 kube-scheduler-7-21 RUNNING pid 63522, uptime 0:09:12 [root@hdss7-21 bin]# kubectl get nodes NAME STATUS ROLES AGE VERSION hdss7-21.host.com Ready v1.15.12 # 已切换版本 hdss7-22.host.com Ready master 3d8h v1.19.2

1.6 开启反代

hdss7-11和hdss7-12执行

[root@hdss7-11 ~]# grep -w " server 10.4.7.21:6443" /etc/nginx/nginx.conf server 10.4.7.21:6443 max_fails=3 fail_timeout=30s; nginx -s reload

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:市面上的手机充电接口都有哪些
下一篇:电视机上的接口有哪些作用
相关文章

 发表评论

暂时没有评论,来抢沙发吧~