Connecting GKE Kube Master with ssh

11/5/2018

I have created a GKE cluster using teraform scripts as private cluster.

The worker nodes are assigned with private IPs (starting with 9.X.X.X) and I am able to to ssh. However, my kube master has been assigned with (172.X.X.X), I am able to connect through gcloud shell.

How can I connect kube master via terminal using ssh?

-- Sunil Gajula
google-kubernetes-engine
kubernetes

2 Answers

11/23/2018

GKE is a managed service from google cloud platform. The worker nodes that we created will hook-on to the manage service and the worker nodes are managed.

If we install kubernetes on VMs (Manually using the kube yum repo) and join the worker nodes to master, then we will have access to master node through ssh command,

-- Sunil Gajula
Source: StackOverflow

11/5/2018

In GKE you can not see the master node from the UI. So, you don't know the public IP of the master node. Hence you can not ssh to kube master from your local terminal.

You can get the cluster credential by running:

$ gcloud container clusters get-credentials ${CLUSTER_NAME}
-- hoque
Source: StackOverflow