Skip to content

[Solved] Unable to connect to the server: dial tcp: lookup with AWS EKS

If you have received the following error while trying to issue commands to kubectl:

Unable to connect to the server: dial tcp: lookup

Then it may be due to your kube-config being out of date. You might just need to update the local kube-config.

How to update the local kube-config

Make sure to replace eu-west-1 with your cluster’s region, and replace cluster_name with the name of your EKS cluster.

aws eks --region "eu-west-1" update-kubeconfig --name "cluster_name"
Code language: plaintext (plaintext)

How to update kube-config from Terraform state

aws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)
Code language: plaintext (plaintext)

The above code makes use of the Terraform state’s output from when you generated the cluster.

See also  How to Read a PDF file in Python
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x