关于kubernetes:升级二进制kubernetes集群

30次阅读

共计 3842 个字符,预计需要花费 10 分钟才能阅读完成。

降级二进制 kubernetes 集群

背景介绍

最近因为工夫有余,临时无奈对小版本更新第一工夫出新的文档。若须要降级集群版本,能够参考此文档进行操作,每个节点一个一个的更新。大版本更新请各位继续关注我的 Github 我的项目仓库。后续更新会在仓库继续更新。感激各位小伙伴始终以来的反对。

此文档基于我的二进制装置仓库 https://github.com/cby-chen/K…

根底操作

查看以后版本信息

[root@k8s-master01 ~]# kubectl  get node
NAME           STATUS   ROLES    AGE   VERSION
k8s-master01   Ready    <none>   57d   v1.23.6
k8s-master02   Ready    <none>   57d   v1.23.6
k8s-master03   Ready    <none>   57d   v1.23.6
k8s-node01     Ready    <none>   57d   v1.23.6
k8s-node02     Ready    <none>   57d   v1.23.6
[root@k8s-master01 ~]#

主机域名以及 IP 地址

[root@k8s-master01 ~]# cat /etc/hosts | grep k8s
192.168.1.230 k8s-master01
192.168.1.231 k8s-master02
192.168.1.232 k8s-master03
192.168.1.233 k8s-node01
192.168.1.234 k8s-node02
[root@k8s-master01 ~]#

下载二进制安装包

[root@k8s-master01 ~]# wget https://dl.k8s.io/v1.23.9/kubernetes-server-linux-amd64.tar.gz
[root@k8s-master01 ~]#

解压二进制安装包

[root@k8s-master01 ~]# tar xf kubernetes-server-linux-amd64.tar.gz
[root@k8s-master01 ~]# 

降级 Maser

降级三台主节点上的客户端

[root@k8s-master01 ~]# scp kubernetes/server/bin/kubectl root@192.168.1.230:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kubectl root@192.168.1.231:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kubectl root@192.168.1.232:/usr/local/bin/
[root@k8s-master01 ~]#

降级三台主节点 api 组件

[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl stop kube-apiserver"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kube-apiserver root@192.168.1.230:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl start kube-apiserver"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# kube-apiserver --version
Kubernetes v1.23.9
[root@k8s-master01 ~]#

降级三台主节点控制器组件

[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl stop kube-controller-manager"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kube-controller-manager root@192.168.1.230:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl start kube-controller-manager"
[root@k8s-master01 ~]#

降级三台主节点选择器组件

[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl stop kube-scheduler"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kube-scheduler root@192.168.1.230:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl start kube-scheduler"
[root@k8s-master01 ~]#

降级 Worker

每一台机器都要降级 kubelet

[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl stop kubelet"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kubelet root@192.168.1.230:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl start kubelet"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# ssh root@192.168.1.230 "kubelet --version"
Kubernetes v1.23.9
[root@k8s-master01 ~]#

每一台机器都要降级 kube-proxy

[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl stop kube-proxy"
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# scp kubernetes/server/bin/kube-proxy root@192.168.1.230:/usr/local/bin/
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# ssh root@192.168.1.230 "systemctl start kube-proxy"
[root@k8s-master01 ~]#

验证

[root@k8s-master01 ~]# kubectl  get node
NAME           STATUS   ROLES    AGE   VERSION
k8s-master01   Ready    <none>   57d   v1.23.9
k8s-master02   Ready    <none>   57d   v1.23.9
k8s-master03   Ready    <none>   57d   v1.23.9
k8s-node01     Ready    <none>   57d   v1.23.9
k8s-node02     Ready    <none>   57d   v1.23.9
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# kubectl  version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.9", GitCommit:"c1de2d70269039fe55efb98e737d9a29f9155246", GitTreeState:"clean", BuildDate:"2022-07-13T14:26:51Z", GoVersion:"go1.17.11", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.9", GitCommit:"c1de2d70269039fe55efb98e737d9a29f9155246", GitTreeState:"clean", BuildDate:"2022-07-13T14:19:57Z", GoVersion:"go1.17.11", Compiler:"gc", Platform:"linux/amd64"}
[root@k8s-master01 ~]#

对于

https://www.oiox.cn/

https://www.oiox.cn/index.php…

CSDN、GitHub、知乎、开源中国、思否、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、集体博客

全网可搜《小陈运维》

文章次要公布于微信公众号

正文完
 0