GoogleCloudPlatform / gke-gitops-tutorial-cloudbuild

GitOps-style Continuous Delivery For Kubernetes Engine With Cloud Build
https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build
Apache License 2.0
119 stars 106 forks source link

Correct kubectl deployment cluster region #9

Closed cbradgoog closed 2 years ago

cbradgoog commented 3 years ago

Change CLOUDSDK_COMPUTE_ZONE=us-central1-b to CLOUDSDK_COMPUTE_REGION=us-central1 to match the cluster creation command in the tutorial [0]:

gcloud container clusters create-auto hello-cloudbuild \
    --region us-central1

Otherwise, Cloud Build would fail with this error:

Step #0 - "Deploy": ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=404, message=Not found: projects/my-project/zones/us-central1-b/clusters/hello-cloudbuild.
Step #0 - "Deploy": Could not find [hello-cloudbuild] in [us-central1-b].
Step #0 - "Deploy": Did you mean [hello-cloudbuild] in [us-central1]?

0: https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build

cbradgoog commented 3 years ago

Never mind. I see why the sample code was given the way it was. For a Standard, zonal deployment, the current sample yaml will indeed work as is. For the Autopilot mode, however, CLOUDSDK_COMPUTE_ZONE=us-central1-b needs to be changed to CLOUDSDK_COMPUTE_REGION=us-central1. Perhaps the doc itself needs to be updated instead to provide an additional step to make the change when Autopilot is used.

MrTrustor commented 2 years ago

Ah, good catch, thank you. Someone updated the tutorial when Autopilot was released, but I suspect didn't retest the whole thing. I'll correct it.

MrTrustor commented 2 years ago

I'm reopening this as this will be part of my fix. I'll merge this PR in sync with the update to the tutorial.