How do I fetch automatically new kubernetes clusters created manually on google cloud

1/18/2018

Supposed that I create a new k8s cluster in console.cloud.google.com interface. Running kubectl config get-contexts currently shows only the current cluster, not the new ones.

How do I fetch it locally so I can run the usual commands from my terminal on the new cluster?

-- Adi Fatol
google-cloud-platform
kubernetes

1 Answer

1/18/2018

You need to use the gcloud command line tool.

First you need to install and setup it, you can follow the guide that suits your environment from the official page: https://cloud.google.com/sdk/downloads

After you need to run the following command:

gcloud container clusters get-credentials <clustername>

More details here: https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials

-- whites11
Source: StackOverflow