k8s “The connection to the server .....:6443 was refused - did you specify theright host or port?”
k8s “The connection to the server .....:6443 was refused - did you specify theright host or port?”
当报错出现该情况的时候,发现 命令是无法查看 nodes 节点了,当初查找很久也没有找到原因。
后面就只能去重新初始化解决!
查看了 systemctl status kubelet
说是没办法找到 master了,再也没有办法就只能初始化了。
当使用 kubeam reset -f 时候就出现以下信息。
故障排除
无法重新初始化,提示就是有这两个端口在占用。
以上提示就是 端口 2379 和 2380 端口被占用 需要kill 之后才行
但使用 pkill etcd 还是会重新起来。
经排查发现是 docker 自启动的,需要停止 etcd
docker ps | grep etcd
5f96e2b5c827 rancher/mirrored-coreos-etcd:v3.4.15-rancher1 "/usr/local/bin/etcd…" 5 hours ago Up 28 seconds etcd
[root@master ~]# docker stop 5f96e2b5c827
5f96e2b5c827
就是在docker 停止 etcd 这个容器,在使用 ss -untpl | grep 2379 检查端口是否在启动。
以上操作完成后 还需要删除 rm -rf /var/lib/etcd 文件夹不然还是会报错
因为不删除该文件夹是 无法初始化 kubeadm 的
重置完成后出现
root@master ~]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
或
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile
以下操作
更多推荐
所有评论(0)