By accessing the website and accepting the Cookie Policy, you agree to use the cookies provided by the Site in accordance with to analyze traffic, remember your preferences, and optimize your experience.

标签 - rancher

k3s k8s rancher etcd    2023-12-08 15:05:22    71    0    0

定位问题

rancher部署的k3s集群无法加入新的etcd节点,查询日志发现报错,etcd群组中出现本应该已被删除的节点prepaid-de,此节点已经被删除,但却错误的留在了etcd member list中,导致etcd服务无法正常验证。

解决思路

移除已经无效的节点prepaid-de,恢复etcd集群的可用性。

解决方案

在k3s集群主控节点安装etcdctl工具。 

一、安装etcdctl

方法一:可以使用apt install命令直接进行安装

apt install etcd-client

方法二:下载对应etcd版本的etcdctl工具手动安装

首先查询获取etcd的版本

curl -L --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --cert /var/lib/rancher/k3s/server/tls/etcd/server-client.crt --key /var/lib/rancher/k3s/server/tls/etcd/server-client.key <https://127.0.0.1:2379/version>

修改ETCD-VER=v 之后的版本号为之前获取到的数字,运行以下命令安装对应版本etcdctl

ETCD_VER=v3.5.0
# choose either URL
GOOGLE_URL=https://storage.googleapis.com/etcd
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
DOWNLOAD_URL=${GOOGLE_URL}
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gzrm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gztar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.