← Back to blog

GCP Workload Identity: Keyless Access for Your Workloads

December 3, 2026
GCP Workload Identity: Keyless Access for Your Workloads

GCP workload identity is how an application proves who it is to Google Cloud without anyone storing a password-like key file. There are two related features. Workload Identity Federation for GKE lets pods in a Kubernetes cluster call Google Cloud APIs. Workload Identity Federation lets workloads running elsewhere (AWS, Azure, GitHub, your own data centre) do the same. Both replace long-lived keys with short-lived tokens, which removes one of the most common ways cloud credentials leak. Getting the IAM bindings right is where most teams lose time, and it is the kind of work we take on for clients as part of cloud and cybersecurity management.

AccountNext-Nexus
accountnext-nexus.com
Replace Cloud Keys With Safer Access
Nexus manages cloud infrastructure and cybersecurity, helping teams simplify security while protecting workloads with tailored services.
Visit

TL;DR

  • Workload identity means a workload authenticates as itself and receives a short-lived token, so there is no service account key to store, rotate or leak.
  • Two products share the name: Workload Identity Federation for GKE (pods inside GKE) and Workload Identity Federation (workloads outside Google Cloud). Google documents them as separate features.
  • For GKE, the direct method is now the recommended one: grant IAM roles straight to the Kubernetes service account's principal identifier.
  • Most failures come from three places: node pool settings, blocked network egress, and an IAM binding that does not match the project number, namespace or service account name.
  • Grant narrowly, one identity per application, and never to a whole pool.

Table of Contents

What workload identity actually solves

Every application that calls a cloud API needs an identity. The old answer was a service account key: a JSON file with a private key inside, copied into a container image, a CI variable or a config map. It works, and it never expires unless somebody remembers to rotate it. Google says plainly that service account keys are a security risk if not managed correctly, advises choosing a more secure alternative where possible, and notes that key creation can be disabled across an entire organization.

For a small business with a thin IT team, a leaked key is the realistic nightmare: one file in a public repository and an attacker holds standing access. For a healthcare provider, the same file can sit between an attacker and regulated patient data. Workload identity removes the file. The workload presents a credential it already has (a Kubernetes token, a cloud-provider identity, a CI token), Google verifies it, and hands back a token that lasts about an hour.

Two features, one confusing name

Search results mix these up, so it is worth separating them early.

Workload Identity Federation for GKEWorkload Identity Federation
Where the workload runsPods in a GKE clusterOn-premises, AWS, Azure, GitHub or GitLab pipelines, other identity providers
What it trustsThe cluster's Kubernetes service accountsAn external identity provider you configure
Setup unitCluster, node pool, Kubernetes service accountWorkload identity pool and provider
Previous nameGKE Workload IdentitySame

Google's own documentation states that the GKE feature is not related to the general Workload Identity Federation, even though the names overlap. It also describes a third product, Workforce Identity Federation, which is for human users, not machines. If your question is "how do my pods get access to Cloud Storage," you want the GKE feature. If it is "how does my GitHub pipeline deploy to Google Cloud," you want the general one.

The naming changed in 2024. Google's product managers explain that GKE Workload Identity was renamed Workload Identity Federation for GKE, along with a simplification that cut setup from six configuration steps to three. Older tutorials still use the previous name and the longer procedure.

How Workload Identity Federation for GKE works

When you enable the feature, GKE creates a workload identity pool named after your project (PROJECT_ID.svc.id.goog), registers the cluster as an identity provider in it, and runs the GKE metadata server on every node. According to Google's GKE concepts documentation, the sequence when a pod needs a token is:

  1. The application calls the usual metadata address through a Google client library.
  2. The GKE metadata server intercepts the request and obtains a Kubernetes service account token for that pod from the cluster's API server.
  3. It exchanges that token with Google's Security Token Service for a short-lived federated access token.
  4. Google Cloud checks the IAM policies that reference the pod's principal identifier.

The metadata server runs as a DaemonSet, so the request never leaves the node. Tokens default to a one-hour lifetime, and client libraries refresh them shortly before they expire, so your developers do not write any renewal code.

The principal identifier is the part to understand, because every access decision hangs on it. It looks like this:

principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/PROJECT_ID.svc.id.goog/subject/ns/NAMESPACE/sa/KSA_NAME

It names a specific Kubernetes service account in a specific namespace. Two applications in different namespaces get different identities, even if the service accounts share a name.

Setting it up: the direct method

Google's how-to guide for GKE describes two approaches and recommends the direct one. Here is the routine, with the points where it usually breaks.

Step 1: Prepare the project and the cluster

Enable the GKE API and the IAM Service Account Credentials API. The person doing the setup needs roles/container.admin and roles/iam.serviceAccountAdmin. Autopilot clusters have the feature on by default. On Standard clusters, enable it at the cluster level by setting the workload pool to PROJECT_ID.svc.id.goog with gcloud container clusters update.

Where it goes wrong: enabling it on the cluster is not enough. Node pools must also use the GKE metadata setting (--workload-metadata=GKE_METADATA), and existing node pools are not changed automatically. A cluster that was upgraded years ago often has older pools quietly still serving the node's own credentials.

Step 2: Create a namespace and Kubernetes service account

Give each application its own service account, in its own namespace. This is the unit of identity, so sharing one across applications means sharing permissions.

Where it goes wrong: pods that omit serviceAccountName run as the namespace's default service account, which then inherits any grants you made to it.

Step 3: Grant IAM roles to the principal

Create an IAM allow policy on the target resource (a bucket, a dataset, a secret) that grants a role to the principal:// identifier above. Pick the narrowest role that works. If the workload reads one secret, grant secret accessor on that secret, not on the project. Google's Secret Manager tutorial for GKE follows this pattern, granting access per namespace and recommending that applications call the Secret Manager API directly, because mounted secret volumes are exposed to directory traversal attacks and environment-variable misconfigurations.

Where it goes wrong: the identifier uses the project number, not the project ID. Mixing them gives you a policy that saves without error and never matches anything.

The alternative: service account impersonation

The older method still has a place. You create an IAM service account, give it the resource roles, grant roles/iam.workloadIdentityUser to the Kubernetes service account on it, and annotate the Kubernetes service account with iam.gke.io/gcp-service-account. Google states that both the policy and the annotation are required. Use it where the direct method is not supported yet: Google lists a small number of services that don't accept federated principals, VPC Service Controls ingress and egress rules that don't support them, and Cloud Run invocation permission, in the same 2024 announcement.

Workload Identity Federation for workloads outside Google Cloud

If the workload runs somewhere else, the general federation is the keyless option. Per Google's IAM documentation, it follows the OAuth 2.0 token exchange specification. The workload hands an identity provider credential to the Security Token Service, which verifies it and returns a federated token. That token can reach resources directly through principal:// or principalSet:// bindings, or it can impersonate a service account (which needs roles/iam.workloadIdentityUser) to obtain a short-lived access token.

External workload federation token exchange flow

Supported sources include AWS, Azure, on-premises Active Directory, X.509 client certificates, GitHub and GitLab pipelines, and external OIDC or SAML 2.0 providers. Google's release notes record that federation reached general availability in April 2021 and X.509 certificate support in May 2025. For AWS EC2, the AWS and Azure federation guide notes that workloads can use short-lived JWTs or AWS IAM credentials without changes on the AWS side.

The setup has a recognizable shape: create a pool, connect your identity provider, then define two IAM policies, one for resource access and one allowing impersonation, as Google's launch post describes. On the application side, Google's auth libraries read a credential configuration file referenced by GOOGLE_APPLICATION_CREDENTIALS, and exchange the external credential automatically.

This matters for multi-cloud shops and for startups whose pipelines live in GitHub but whose infrastructure lives in Google Cloud: the pipeline stops carrying a key.

Security practices that keep it safe

Keyless does not mean risk-free. It moves the risk from a file to a configuration, and configuration mistakes are quieter than leaked files.

Mind identity sameness. Google's best-practices guidance explains that federation uses claims-based identities, so two tokens from the same provider whose claims map to the same subject value are treated as the same identity. Choose attribute mappings that distinguish one workload from another. The same document names four threats to design against: spoofing, privilege escalation, non-repudiation and malicious credential configurations.

Use one identity per application. Google recommends a dedicated service account per application and advises against granting access to all members of a pool. The CIS GKE Benchmark goes in the same direction: version 1.7.0 recommends at Level 1 that clusters not run on the Compute Engine default service account, and at Level 2 that each workload has its own service account with workload identity enabled.

Watch fleet-wide pools. Google's fleet documentation says that a fleet-level pool spanning clusters in different projects gives implicit identity sameness across the fleet. That simplifies cross-project access, and it also means an identity in one cluster can match the same-named identity in another. Plan namespaces and service account names accordingly.

Use organization policy. Google added Organization Policy custom constraints for workload identity and federation in April 2026, according to the same IAM release notes. They let a security team enforce which providers and configurations are allowed across projects.

Keep secrets out of the cluster. Workload identity pairs naturally with a secrets manager. Our guide on cloud secrets management covers how to decide what belongs where.

Security practices that keep it safe

Troubleshooting a pod that cannot authenticate

When a pod returns permission errors or timeouts, work through the checks in Google's GKE authentication troubleshooting guide, in this order:

  1. Cluster: confirm the cluster's workloadPool is set.
  2. Node pool: confirm workloadMetadataConfig.mode is GKE_METADATA.
  3. Network: allow egress to the metadata server at 169.254.169.252 on port 988 (or 169.254.169.254 on port 80 with Dataplane V2), and outbound HTTPS to sts.googleapis.com on port 443. A 504 Gateway Timeout or "context deadline exceeded" points to blocked egress, which is common behind strict network policies.
  4. Binding: confirm the principal:// binding matches the project number, namespace and service account name exactly.

The discipline matters more than the commands: change one thing, retest, and write down what the failure message said. The same habit of methodical, one-variable-at-a-time diagnosis runs through other infrastructure fixes too, such as this walkthrough of MTA-STS setup and fixes.

If you are also planning a move into Google Cloud, build the identity model before the workloads arrive, not after. Our GCP migration guide covers the planning order.

Who should do this themselves, and who should not carry it alone

The configuration is not hard on a single cluster. The cost comes from scale: dozens of namespaces, several projects, a CI pipeline in another cloud, auditors asking who can reach what. Cloud security is also split between provider and customer, and identity configuration sits on the customer's side of that line, as we explain in our piece on shared responsibility in cloud security. For a small team, a missed node pool or an over-broad grant is easy to make and slow to notice. For a healthcare provider or a startup chasing SOC 2, it also becomes an audit question.

Perspective

Most of the identity incidents we hear described to us start the same way: a key created for convenience, then forgotten. Workload identity is the right direction, and we treat it as a baseline, not an upgrade.

What we care about is the part after the tutorial. Identity design touches cloud, network, monitoring and compliance at once. When those sit with four different vendors, each assumes another one owns the gap between them. Our approach is to consolidate cybersecurity, cloud management and compliance under one provider with one SLA, so the person who configures the principal binding is working alongside the person watching for abuse of it.

Our services are built around 24/7 threat detection, cloud management across AWS, Azure and Google Cloud, and compliance work for frameworks such as SOC 2, HIPAA, PCI-DSS and ISO 27001. Federation configuration is exactly where those disciplines meet, and we think one accountable team handles it better than three.

Nick - Sr. Executive

Put identity design in expert hands

If you run workloads on Google Cloud and want keyless access designed, reviewed and monitored as part of a single service, our cybersecurity and cloud services cover cloud migration and management, 24/7 monitoring and compliance assessments under one contract with a fixed-fee model.

AccountNext-Nexus

FAQ

What is the difference between Workload Identity and Workload Identity Federation?

"Workload Identity" was the former name of the GKE feature, now called Workload Identity Federation for GKE. It serves pods inside GKE clusters. Workload Identity Federation is a separate feature for workloads outside Google Cloud, such as AWS, Azure or GitHub pipelines. Both give workloads short-lived tokens in place of service account keys.

Do I still need service accounts?

Often not. The direct method on GKE grants roles to the Kubernetes service account's principal identifier without an IAM service account. Impersonation is still used where a service doesn't yet accept federated principals, and Google continues to list service accounts as an option for production workloads in its workload identity documentation.

Why does my pod get a permission error even though I granted the role?

The usual causes are a node pool without the GKE metadata setting, an IAM binding written with the project ID instead of the project number, or a pod running under the default Kubernetes service account. Check those, then egress to the metadata server and the Security Token Service.

How long do the tokens last?

Google's GKE documentation gives a default access token lifetime of one hour. Client libraries refresh tokens shortly before they expire, so applications built on them need no extra code.

Does this apply to organizations in the United States specifically?

The features are the same everywhere Google Cloud operates. What differs by country is the compliance layer around them: a US healthcare provider, for example, maps access controls like these to HIPAA requirements.

Sources