You want to create or edit a Kubernetes service but when running e.g.
kubectl create -f my-service.yml
you see an error message similar to this:
Unable to connect to the server: dial tcp 188.8.131.52:443: i/o timeout
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 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 container clusters list