How to fix kubectl Unable to connect to the server: dial tcp ...:443: i/o timeout
Problem:
You want to create or edit a Kubernetes service but when running e.g.
kubectl-create-my-service.sh
kubectl create -f my-service.yml
you see an error message similar to this:
kubectl-timeout-error.txt
Unable to connect to the server: dial tcp 35.198.129.60:443: i/o timeout
Solution
There are three common reasons for this issue:
- Your Kubernetes cluster is not running. Verify that your cluster has been started, e.g. by pinging the IP address.
- There are networking issues that prevent you from accessing the cluster. Verify that you can ping the IP and try to track down whether there is a firewall in place preventing the access
- You have configured a cluster that does not exist any more.
In case of Google Cloud Kubernetes, case (3) can easily be fixed by configuring Kubernetes to use your current cluster:
gcloud-get-credentials.sh
gcloud container clusters get-credentials [cluster name] --zone [zone]
This will automatically update the default cluster for kubectl.
In case you don’t know the correct cluster name and zone, use
gcloud-list-clusters.sh
gcloud container clusters list
Check out similar posts by category:
Cloud, Container, Kubernetes
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow