一、配置etcdctl环境变量
#其中证书实际路径和endpoints,以环境情况为准,查询方式
ps -ef | grep 'etcd-cafile'
ps -ef | grep 'etcd-servers'
export ETCDCTL_API=3
export ETCDCTL_CACERT=/etc/kubernetes/ssl/etcd/ca.crt
export ETCDCTL_CERT=/etc/kubernetes/ssl/etcd/etcdctl-etcd-client.crt
export ETCDCTL_KEY=/etc/kubernetes/ssl/etcd/etcdctl-etcd-client.key
export ETCDCTL_DIAL_TIMEOUT=3s
export ETCDCTL_ENDPOINTS=https://10.12.107.99:2379,https://10.12.107.100:2379,https://10.12.107.101:2379
二、确保有etcdctl命令,如果没有去官网下载二进制包安装即可
三、从集群中剔除故障节点(确保故障节点etcd服务已停止 systemctl stop etcd)
#集群成员信息
etcdctl -wtable member list
#集群主从同步情况
etcdctl -wtable endpoint status
etcdctl -wtable endpoint health
摘除一个节点
etcdctl member remove 成员id
四、清空故障节点etcd的数据目录
mv /var/lib/etcd /var/lib/etcd_bak
五、加入节点 (确保etcd启动参数etcd.env中--initial-cluster-state 为existing)
etcdctl member add 成员名称(主机名) --peer-urls=https://10.8.47.13:2380
六、启动etcd服务
systemctl start etcd