[Solved] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout connect: connection refused
- Last Updated On: February 7, 2024
- By: Aswin Vijayan
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.
Aswin Vijayan
Other Interesting Blogs
[80% OFF] Linux Foundation Coupon for November 2024
Hi Techies, I wanted to let you know about a pretty sweet deal with the Linux Foundation Coupon that is running now.
[40% OFF] Linux Foundation LFCA, LFCS & LFCT Exam Voucher Codes
Linux Foundation has announced up to a $284 discount on its Linux certification programs Linux Foundation Certified IT Associate (LFCA) and Linux
CKA Certification Study Guide (Certified Kubernetes Administrator)
This comprehensive CKA certification exam study guide covers all the important aspects of the Certified Kubernetes Administrator exam and useful resources. Passing