学无先后,达者为师

网站首页 编程语言 正文

kubeadm报错:The connection to the server localhost:8080 was refused - did you specify the right host

作者:Kevin古月 更新时间: 2022-04-01 编程语言

报错现象

[root@k8s-node1 ~]# kubectl apply -f calico.yaml 
The connection to the server localhost:8080 was refused - did you specify the right host or port?

报错原因

kubectl命令需要使用kubernetes-admin来运行

解决方法

将主节点(master节点)中的【/etc/kubernetes/admin.conf】文件拷贝到从节点相同目录下:
scp -r /etc/kubernetes/admin.conf ${node1}:/etc/kubernetes/admin.conf

配置环境变量:
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile

立即生效:
source ~/.bash_profile


原文链接:https://blog.csdn.net/m0_47219942/article/details/110873509

栏目分类
最近更新