How Do You Troubleshoot the Error “Unable to connect to the server: dial tcp: lookup … on x.x.x.x:53: no such host” when Running kubectl Commands?

Problem scenario
kubectl commands are failing with an error message like this: "Unable to connect to the server: dial tcp: lookup on x.x.x.x:53: no such host"

How do you get kubectl commands to work?

Possible Solution #1
If you are using EKS and you have the name of the cluster (e.g., "foobar"), run a command like this:

aws eks update-kubeconfig --name foobar

Possible Solution #2

  1. Find what VPC your EC-2 instance is in. Remember the x.x.x.x IP address in the error message above. Now look at the relevant VPC. One way to find the relevant VPC would be to use the AWS CLI (link to this posting). Then run this command: aws ec2 describe-vpcs Look at the output. Find the VpcId value for the x.x.x.x IP address.
  2. In the web UI, go here (but replace "west-1" with the region seen in the error):
  1. Click on the VPC that was determined in step #1.
  2. Make sure DNS resolution and DNS hostnames are enabled. These are two separate features of a VPC.

Possible Solution #3
Try redeploying the Kubernetes cluster. The cluster itself may have issues. If you want explicit directions on creating an EKS cluster, see these postings:

Join the Conversation


  1. solution 1 worked for me
    and the new ARN is updated (for my new cluster ) in kube config file. Post that I am able to create the deployment.
    Thank you so much for helping !

    1. Regulatory Disclosure
      This article was brought to you by a Google LLC employee. This article does not reflect the opinions of Google LLC.

Leave a comment

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