1.报错:
在删除节点并kubeadm reset后,执行kubeadm 加入节点时候报错如下错误:
error execution phase check-etcd: etcd cluster is not healthy: failed to dial endpoint https://192.168.123.42:2379 with maintenance client: context deadline exceeded
2.解决办法:
出现这个报错的原因是之前的etcd集群信息没有清理干净。
- 执行命令,查看etcd节点列表:
# kubectl get pod -n kube-system
- 进入etcd-worker-1容器内部:
# kubectl exec -it etcd-worker-1 -n kube-system -- sh
- k8s中etcd使用的是v3的api,所以要先声明变量:
# export ETCDCTL_API=3
- 查看当前etcd节点数量:
# etcdctl --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/server.crt" --key="/etc/kubernetes/pki/etcd/server.key" member list
- 删除报错的节点:
# etcdctl --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/server.crt" --key="/etc/kubernetes/pki/etcd/server.key" member remove e4b7787f9db35781