k8s从节点报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

 原因:kubernetes-admin命令没有同步过来

解决办法:

将主节点的配置 /etc/kubernetes/admin.conf 复制到本机,再重新声明环境变量

1、复制配置文件

scp root@主节点服务器地址:/etc/kubernetes/admin.conf /etc/kubernetes/

2、添加环境变量

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile

3、申明环境变量

source ~/.bash_profile

4、重新查看配置

[root@k8s-node01 local]# kubectl get nodes
NAME           STATUS     ROLES    AGE   VERSION
k8s-master01   NotReady   master   38m   v1.14.0
k8s-node01     NotReady   <none>   21m   v1.14.0
k8s-node02     NotReady   <none>   21m   v1.14.0

 

posted on 2020-11-11 12:04  wangzy-Zj  阅读(5148)  评论(0编辑  收藏  举报