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

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


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

sudo mkdir ~/.kubesudo cp /etc/kubernetes/admin.conf ~/.kube/cd ~/.kubesudo mv admin.conf configsudo service kubelet restart


you need to specify kubeconfig for kubectl like this.

kubectl --kubeconfig .kube/config  get nodes


kubectl consumes an interface exposed by a Container Service(GCP, ACS or AWS)When you receive that error it could be that you didn't configure the authentication to that Container Service(GCp, ACS, AWS, or etc)For example in Google Container Service you can do:gcloud auth login

Finally

gcloud container clusters get-credentials [cluster-name] --zone cluster-zone[cluster-zone]

There will be an output like this one:

Fetching cluster endpoint and auth data.kubeconfig entry generated for website.

The last line is what we were searching for