我是靠谱客的博主 淡然香烟,这篇文章主要介绍K8s ❉ The connection to the server 报错localhost:8080 was refused,现在分享给大家,希望可以做个参考。
现象描述
K8s集群初始化成功后,kubectl get nodes 查看节点信息时报错:
报错信息:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决办法:
执行以下命令
[root@slave1 ~]# kubectl get pod,svc
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[root@slave1 ~]# mkdir -p $HOME/.kube
[root@slave1 ~]# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@slave1 ~]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
[root@slave1 ~]# source ~/.bash_profile
[root@slave1 ~]# chown $(id -u):$(id -g) $HOME/.kube/config
[root@slave1 ~]# kubectl get pod
NAME
READY
STATUS
RESTARTS
AGE
nginx-6867cdf567-966sx
1/1
Running
0
15m
最后
以上就是淡然香烟最近收集整理的关于K8s ❉ The connection to the server 报错localhost:8080 was refused的全部内容,更多相关K8s内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复