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

10/18/2019

when i run this command mentioned below kubectl get po -n kube-system I get this error :: The connection to the server localhost:8080 was refused - did you specify the right host or port?

-- Adarsha Jha
google-kubernetes-engine
kubernetes

1 Answer

10/18/2019

localhost:8080 is the default server to connect to if there is no kubeconfig present on your system (for the current user).

Follow the instructions on the page linked. You will need to execute something like:

gcloud container clusters get-credentials [CLUSTER_NAME]

-- Janos Lenart
Source: StackOverflow