Why zone for get-credentials?

987 views
Skip to first unread message

Anatoli Babenia

unread,
Sep 15, 2017, 10:04:25 AM9/15/17
to Google Cloud Developers

I've created a single cluster in single zone. Why I am asked to specify zone in get-credentials?
Help mentions it is optional parameter https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials

gcloud container clusters get-credentials quickstart
ERROR
: (gcloud.container.clusters.get-credentials) One of [--zone] must be supplied: Please specify zone

Zachary Newman

unread,
Sep 15, 2017, 10:17:47 AM9/15/17
to Anatoli Babenia, Google Cloud Developers
Though in your particular case, the name of the cluster *is* sufficient to disambiguate, it's impossible to know that in general–you might have a cluster with the same name in multiple zones. It would slow down the command if we did another round-trip to check uniqueness, not to mention opening up the possibility of race conditions.

The --zone flag is listed as optional because it's only necessary if you don't have the compute/zone property set. But the zone of the cluster needs to be specified by property or by flag.

I hope that clarifies things!

--
You received this message because you are subscribed to the Google Groups "Google Cloud Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-dev/725bfbe9-96a3-406f-8f92-de1e463e666f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anatoli Babenia

unread,
Sep 15, 2017, 10:53:45 AM9/15/17
to Zachary Newman, Google Cloud Developers
Did I understood you right that for each cluster in each zone I need to get separate credentials?

Second question - where should I set compute/zone property to make --zone flag unnecessary?

Zachary Newman

unread,
Sep 15, 2017, 1:53:07 PM9/15/17
to Anatoli Babenia, Google Cloud Developers
Answered inline:

On Fri, Sep 15, 2017 at 10:47 AM, Anatoli Babenia <ana...@rainforce.org> wrote:
Did I understood you right that for each cluster in each zone I need to get separate credentials?
Yes, the credentials are per-cluster. 

Second question - where should I set compute/zone property to make --zone flag unnecessary?
Run `gcloud config set compute/zone MY_ZONE`. 
Reply all
Reply to author
Forward
0 new messages