I have been tying to update a deployment in a GKE cluster using CircleCI. I was able to make container build and upload to GCR work just fine.
But I could not find a way to specify the GCP region when authenticating using the command such as gcloud --quiet container clusters get-credentials $K8S_CLUSTER --region=$MY_REGION
for updating my Kubernetes deployment.
#!/bin/bash -eo pipefail
gcloud --quiet config set project $GOOGLE_PROJECT_ID
gcloud --quiet config set compute/region $MY_REGION
gcloud --quiet container clusters get-credentials $K8S_CLUSTER --region $MY_REGION
kubectl set image deployment/$DEPLOYMENT $APP_NAME=gcr.io/$PROJECT_ID/$APP_NAME:v2
Updated property [core/project].
Updated property [compute/region].
ERROR: (gcloud.container.clusters.get-credentials) unrecognized arguments:
--region
asia-southeast1
Exited with code 2
We know there's an argument called --region
to specify the region.
root@host# gcloud container clusters get-credentials -h
Usage: gcloud container clusters get-credentials NAME [optional flags]
optional flags may be --help | --internal-ip | --region | --zone
For detailed information on this command and its flags, run:
gcloud container clusters get-credentials --help
root@host#
Why doesn't CircleCI's version of gcloud does not support this parameter?