39. 如何替换 Rancher 本地 RKE2 集群中的控制平面节点
现在,向要移除的节点开启一个 SSH 会话。最佳实践是作系统与其他集群节点保持一致(相同的发行版和版本),并符合。提到的步骤,对 Rancher 本地集群做一个 etcd 备份。Rancher v2.5+ 运行在 RKE2 集群上。首先,确保节点配备了文档中提到的支持作系统(在任意现有节点上执行以下命令,确保节点状态为。在同一 SSH 会话中,在待移除节点上运行。将新节点注册为本地集群中的额外控制
·
环境
- Rancher v2.5+ running on an RKE2 cluster
Rancher v2.5+ 运行在 RKE2 集群上
Procedure 程序
- First, make sure to prepare a node with a supported operating system (OS) as mentioned in the documentation. Best practice is that the OS is aligned (the same distribution and version) with the other cluster nodes and in compliance with the SUSE Rancher Support Matrix.
首先,确保节点配备了文档中提到的支持作系统(OS)。 最佳实践是作系统与其他集群节点保持一致(相同的发行版和版本),并符合 SUSE Rancher 支持矩阵 。 - Take an etcd backup of the Rancher local cluster using the steps mentioned here.
按照这里提到的步骤,对 Rancher 本地集群做一个 etcd 备份。 - You can additionally take a backup of Rancher state using the Rancher Backup Operator.
你也可以使用牧场主备份运营商获取牧场主状态。 - Follow the steps to register the new node as an additional control plane node in the local cluster.
按照步骤将新节点注册为本地集群中的额外控制平面节点。 - Verify that etcd also shows the new node as a member by running the command below on the new node:
通过在新节点上执行以下命令,验证 etcd 是否也将新节点显示为成员:export CRI_CONFIG_FILE=/var/lib/rancher/rke2/agent/etc/crictl.yaml etcdcontainer=$(/var/lib/rancher/rke2/bin/crictl ps --label io.kubernetes.container.name=etcd --quiet) /var/lib/rancher/rke2/bin/crictl exec $etcdcontainer etcdctl --cert /var/lib/rancher/rke2/server/tls/etcd/server-client.crt --key /var/lib/rancher/rke2/server/tls/etcd/server-client.key --cacert /var/lib/rancher/rke2/server/tls/etcd/server-ca.crt endpoint health --cluster --write-out=table - Run the command below on any existing node to ensure the node status is
Ready:
在任意现有节点上执行以下命令,确保节点状态为准备就绪:kubectl get nodes - Now, open an SSH session to the node to be removed. Stop and disable the rke2-server service:
现在,向要移除的节点开启一个 SSH 会话。停止并禁用 rke2 服务器服务:systemctl stop rke2-server systemctl disable rke2-server - In the same SSH session, on the node to be removed, run the
rke2-killall.shcleanup script, to terminate all Pod and RKE2 related processes:
在同一 SSH 会话中,在待移除节点上运行rke2-killall.sh清理脚本,终止所有与 Pod 和 RKE2 相关的进程:rke2-killall.sh - Delete the node from the Kubernetes cluster by running the command below on any other control plane node in the cluster:
通过在集群中任何其他控制平面节点上执行以下命令,删除该节点:kubectl delete node <NODENAME> - Verify that the node is deleted:
确认节点已被删除:kubectl get nodes
更多推荐
所有评论(0)