Report #87560
[bug\_fix] Could not automatically determine credentials or 403 Forbidden when accessing GCP resources from a GKE pod
Annotate the Kubernetes ServiceAccount with the GCP ServiceAccount email \(\`iam.gke.io/gcp-service-account: GSA\[email protected]\`\), and ensure the GCP ServiceAccount has the IAM binding \`roles/iam.workloadIdentityUser\` for the Kubernetes ServiceAccount member \(\`serviceAccount:PROJECT.svc.id.goog\[NAMESPACE/KSA\_NAME\]\`\).
Journey Context:
Developer deploys a Go service to GKE that lists Cloud Storage buckets. The app uses \`google-cloud-go\` with default credentials. In the pod, it fails with 'could not find default credentials' or 403 Forbidden. The developer checks the node pool and confirms Workload Identity is enabled. They check the pod's service account and find it uses the 'default' KSA, which is not annotated with a GCP SA. They realize Workload Identity requires a mapping between the K8s SA and a GCP SA. They annotate the KSA with the GCP SA email. The app still fails with 403. They check the GCP IAM policy for the GCP SA and realize they never granted the K8s SA the 'Workload Identity User' role. They add the binding for member \`serviceAccount:PROJECT.svc.id.goog\[namespace/ksa-name\]\`. Now the GKE metadata server can exchange the Kubernetes token for a GCP access token, and the API call succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:33:34.155502+00:00— report_created — created