[Solved] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout connect: connection refused

Issue: When trying to access the kubernetes cluster using kubectl you might get the couldn’t get current server API – connection refuse error.

Here is the full error.

E0202 10:40:56.460499    6352 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused

This error could be due to four issues. All the issues and its solutions are explained below.

Issue 1: User doesnt have the Kubeconfig file

This error primarily happens due to Kubeconfig file not present in the users $HOME/.kube/config location.

Kubectl will try to access the config file for this location.

For example, if the kubeconfig file is added to ubuntu user home and if you try to access kubectl from the root user, you will get the error.

So ensure the kubeconfig file is present in the users home directory.

Issue 2: Unavailable Cluster

If you have the Kubeconfig file under users folder and still facing connection refused error, it could be due to unavailable cluster.

Ensure you have the cluster up and running.

Also, check if you have set the current context to the correct cluster.

Issue 3: Unreachable API Server

If you are trying to reach a Kubernetes cluster deployed in a private network, you will get the connection refused error.

For example, you might have deployed a Kubernetes cluster with a private IP in cloud environment. If you try to access that cluster from your workstation, you cannot connect to it.

Issue 4: Firewall Issue

If you have a Kuberntes cluster running remotely, ensure the firewall rules accept connection on port 6443 from the machine you are trying to access the API server.

If you have the cluster on cloud, check the firewall rules for control plane node for incomming connections on port 6443.

Other Interesting Blogs

Leave a Comment

Share via
Copy link
Powered by Social Snap