The connection to the server localhost:8080 was re

2019-02-15 19:22发布

when i am trying to test the configuration of kubectl

kubectl get svc 

i am getting this error: the server doesn't have a resource type "svc"

when I try this command

kubectl get services 

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

and i am following this userguide to deploy a kubernetes application on my mac

https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-create-cluster

Admins-MacBook-Pro:~ Harshin$ kubectl version --short --client

Client Version: v1.10.3

please help me!!

2条回答
虎瘦雄心在
2楼-- · 2019-02-15 19:47

Make a copy of the config file and resolve this issue:

sudo mkdir ~/.kube
sudo cp /etc/kubernetes/admin.conf ~/.kube/

cd ~/.kube

sudo mv admin.conf config
sudo service kubelet restart
查看更多
SAY GOODBYE
3楼-- · 2019-02-15 19:49

you need to specify kubeconfig for kubectl like this.

kubectl --kubeconfig .kube/config  get nodes
查看更多
登录 后发表回答