The connection to the server localhost:8080 was refused - did you specify the right host or port?

it2023-01-22  79

在k8s的node节点上执行命令报错如下

kubectl get pod --all-namespaces

master节点

scp  -r /etc/kubernetes/admin.conf root@10.238.162.32:/etc/kubernetes/admin.conf 

scp  -r /etc/kubernetes/admin.conf root@10.238.162.34:/etc/kubernetes/admin.conf

node 节点执行

配置环境变量

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

生效

source ~/.bash_profile

再次查看不再报错

kubectl version

kubectl get pod --all-namespaces

 

https://blog.csdn.net/lfm940624/article/details/84706118

最新回复(0)