this step doesn't work for me in my project,
steps:
- name: 'gcr.io/cloud-builders/kubectl'
args: ['get', 'pods']
env:
- 'CLOUDSDK_COMPUTE_ZONE=us-east4-b'
- 'CLOUDSDK_CONTAINER_CLUSTER=your-cluster'
I set this up, but I've got this:
Step #2: Already have image (with digest): gcr.io/cloud-builders/kubectl
Step #2: Running: gcloud container clusters get-credentials --project="env-" --zone="europe-west1-b" " -env-dev"
Step #2: Fetching cluster endpoint and auth data.
Step #2: ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Required "container.clusters.get" permission for "projects/env-/zones/europe-west1-b/clusters/ -env-dev".
Finished Step #2
In console the same command works fine:
Fetching cluster endpoint and auth data.
kubeconfig entry generated for-env-dev.
I think the error message is saying that the Cloud Builder service doesn't have access to your GKE clusters. You might want to double check the IAM permissions for Cloud Builder that are described here: https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/kubectl#using-this-builder-with-google-kubernetes-engine.
I believe that @leejones explanation will resolve this issue @sneerin , so I'm marking as closed. Feel free to re-open if I am incorrect.
Most helpful comment
I think the error message is saying that the Cloud Builder service doesn't have access to your GKE clusters. You might want to double check the IAM permissions for Cloud Builder that are described here: https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/kubectl#using-this-builder-with-google-kubernetes-engine.