Workload Identity on multi-tenant GKE: know what your IAM bindings match

This post is for platform teams running multi-tenant Kubernetes on GCP. Use Workload Identity Federation for GKE for every pod that calls Google Cloud APIs. On a shared platform, the IAM binding needs the most care, because the principal you bind decides which tenants’ pods get the access. By the end you should know which principal type to use, which to avoid, and when the advice changes.

Why it is the default

Google’s overview of Workload Identity Federation for GKE calls it the recommended way, in most cases, for GKE workloads to access Google Cloud services. It lets you grant Kubernetes workloads access to specific APIs through IAM policies “without needing manual configuration or less secure methods like service account key files.” It also lets you give each application in the cluster its own fine-grained identity. It replaces metadata concealment and protects the same sensitive metadata.

For a multi-tenant platform, the per-application identity matters most. A key file in a Secret belongs to whoever can read that Secret. An identity tied to a Kubernetes ServiceAccount belongs to the pods that run as that ServiceAccount, and you already manage that boundary.

What enabling it actually creates

When you turn it on, GKE creates a fixed workload identity pool for the cluster’s project, named PROJECT_ID.svc.id.goog. It registers the cluster as an identity provider in that pool and deploys the GKE metadata server on every node to intercept credential requests. GKE doesn’t delete the pool even if you delete every cluster in the project.

That design shapes the rest of this post. The pool belongs to the project, not to the cluster. Every cluster in the project with the feature enabled is a provider in the same pool.

Choosing the principal

The overview lists several principal types. This is how I’d use each one on a shared platform:

The Kubernetes side has one more trap. The Kubernetes service account documentation notes that every namespace gets a default ServiceAccount, and that a Pod with no ServiceAccount set is assigned that default. If you grant IAM roles to a tenant namespace’s default account, those roles reach every pod in that namespace that didn’t ask for an identity. I’d give each workload a named ServiceAccount and keep the default accounts free of IAM grants.

Scoping the grant itself

Bind on the specific resource where you can, such as a bucket or a secret, rather than at the project or folder level. Where you must bind higher up, the overview describes IAM conditions for that case: expiring access with request.time, or matching resource tags with resource.matchTag. When a project-level binding can’t be avoided, a tag condition is a reasonable way to keep a tenant’s grant on that tenant’s resources.

Rolling it out on Standard clusters

On Autopilot the feature is always enabled. On Standard, the GKE how-to guide says you enable it on the cluster first. Existing node pools are unaffected, and only new node pools use it until you update the old ones. A node pool can also be opted out with --workload-metadata=GCE_METADATA. On a shared cluster I’d audit for any pool still on GCE_METADATA and treat it as an unfinished migration. I’d also follow the guide’s advice to pass --workload-metadata=GKE_METADATA when creating pools, so that creation fails if the cluster isn’t enabled.

When this advice changes

There are two cases. First, the API you need may not be supported, or the service’s limitations may block your use case. For that, the same guide points to an alternative: linking Kubernetes ServiceAccounts to IAM service accounts. I wouldn’t assume the principal choices above carry over to it. Check that alternative’s identity mapping and access scope on their own terms before you rely on it for a tenant boundary.

Second, the shared-pool concern disappears if each trust boundary already has its own project. If your tenants don’t trust each other and can create namespaces, I’d give each tenant boundary its own project. That is simpler than relying on everyone to write UID-based bindings correctly.

Enable the feature everywhere, keep tenant grants on named or UID-selected ServiceAccounts, and keep default accounts out of IAM. Then decide now whether your projects or your bindings are what keeps one tenant’s pods away from another’s resources.