Kubernetes : dial tcp 127.0.0.1:8080: connect: connection refused Kubernetes : dial tcp 127.0.0.1:8080: connect: connection refused kubernetes kubernetes

Kubernetes : dial tcp 127.0.0.1:8080: connect: connection refused


Kubernetes uses a $KUBECONFIG file for connecting to clusters. It may be when provisioning your kops cluster, it didn't write the file correctly. I can't be sure as you haven't provided enough info.

Assuming this is the issue, and you only have a single cluster, it can be resolved like so:

# Find your cluster namekops get clusters# set the clustername as a varclustername=<clustername># export the KUBECONFIG variable, which kubectl uses to find the kubeconfig fileexport KUBECONFIG=~/.kube/${clustername}# download the kubeconfig file locally using kopskops export kubecfg --name ${clustername} --config=~$KUBECONFIG

You can find more information about the KUBECONFIG file here


you have to start minikube before using kubectlI had the same issue but mine was because minikube was not running