kubectl command timeout on Google Kubernetes Engine

8/1/2018

I setup a cluster from the kubernetes dashboard with 2 nodes in the private network.

I have exposed the port 80 that maps to port 8545 from the container instances. So, when I access the external IP I can view my application.

I set up a kubectl on my machine and ran the following command

gcloud container clusters get-credentials <cluster name> --zone <my-zone> --project <project name>

However, when I run this I get an error

$ kubectl get deployments
Unable to connect to the server: dial tcp 35.194.113.118:443: i/o timeout

On the GCP dashboard, I see the following for the cluster

Endpoint    
35.194.113.118

It also has a view credentials option next to it which has a certificate file and username and password

So, I tried setting it

kubectl config set-credentials cluster-admin --username=admin --password=<my password>

I tried kubectl command again, however I get the same timeout error. Can someone help to fix this?

-- kosta
google-kubernetes-engine

1 Answer

8/1/2018

I added an authorized network by editing the cluster and selecting Add Authorized network. This seems to have solved the problem.

https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters

-- kosta
Source: StackOverflow