kelseyhightower / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way. No scripts.
Apache License 2.0
41.3k stars 14.13k forks source link

Default Region API Doesn't Work #659

Open parth-pandit opened 3 years ago

parth-pandit commented 3 years ago

Below code does not pull the value of the default region.

REGION=$(curl -s -H "Metadata-Flavor: Google" \ http://metadata.google.internal/computeMetadata/v1/project/attributes/google-compute-default-region)

This is on Bootstrapping the Kubernetes Control Plane page.

geoffsisson commented 3 years ago

You can populate the necessary metadata by running:

gcloud compute project-info --project PROJECT add-metadata --metadata google-compute-default-region=REGION

... where PROJECT is your project name and REGION is the region of your cluster.

Possibly this needs to be added to the Provisioning Compute Resources page or maybe the Prerequisites page.

ichandan16 commented 3 years ago

I used this command to get the region:

curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone | cut -d/ -f 4 | sed 's/.\{2\}$//'

get-region