How Do You Troubleshoot a kubectl Command That Returns “The connection to the server localhost:8080 was refused – did you specify the right host or port?”?

One of the following problems pertains to you.

Problem scenario #1

You have a kubectl server. You created some new EKS clusters. How do you get the kubectl server to interface, control or manage the new EKS clusters.

or

Problem scenario #2

You are running EKS. You run this command:

kubectl get cluster-info

But you receive this message: "The connection to the server localhost:8080 was refused - did you specify the right host or port?"

What should you do?

Solution

  1. Find the name of your EKS clusters. Run this command: aws eks list-clusters
  2. The results will be names that you can use for this command:

aws eks update-kubeconfig --name foobar

# substitute foobar with the name of a cluster in the result of step #1

3. If you are still getting the error, see this posting or this posting. If you are not using GCP or AWS, you may want to see this posting. If you are using GCP, see this posting.

Leave a comment

Your email address will not be published. Required fields are marked *