Sub topic 14
Comparing the provider approaches
This chapter assumes you know how projected service account tokens, the cluster's OIDC issuer, and token federation work, and that you have seen the EKS, GKE, and AKS setups from the earlier chapters. Here you compare them so you can choose and migrate with a clear model.
The shared pattern
All three providers use the same flow. The kubelet projects a short-lived token with a provider-specific audience. A mutating webhook or node component wires it into the Pod. The workload sends the token to the cloud's token service, which checks the signature against the cluster's public keys and checks the sub and aud claims. If both match a trust rule, it returns cloud credentials.
The providers differ in where the trust rule lives and how the Pod is wired up.
Side-by-side comparison
| Aspect | EKS IRSA | GKE | AKS |
|---|---|---|---|
| ServiceAccount marker | `eks.amazonaws.com/role-arn` annotation | `iam.gke.io/gcp-service-account` annotation | `azure.workload.identity/client-id` annotation |
| Pod opt-in | Automatic for Pods using the annotated ServiceAccount | Automatic, through the GKE metadata server | Label `azure.workload.identity/use: "true"` |
| Where trust is defined | IAM role trust policy naming the cluster's OIDC provider | IAM policy binding on the Google service account | Federated credential on the Entra application or managed identity |
| Subject format | `system:serviceaccount:demo:app-reader` | `my-project.svc.id.goog[demo/app-reader]` | `system:serviceaccount:demo:app-reader` |
| Typical audience | `sts.amazonaws.com` | Set by the platform | `api://AzureADTokenExchange` |
| Cluster registration | IAM OIDC provider per cluster | Built in to the GKE cluster | Issuer URL entered in each federated credential |
Where the trust rule lives
The trust rule sits in a different place on each cloud, and this affects who can change it.
- EKS: The rule is in the role's trust policy. Whoever administers the IAM role controls which ServiceAccounts can assume it.
- GKE: The rule is an IAM binding of
roles/iam.workloadIdentityUseron the Google service account. You can also grant roles directly to the Kubernetes principal and skip the Google service account. - AKS: The rule is a federated identity credential. It stores the issuer, the subject, and the audience, so each ServiceAccount needs its own credential.
In every case, the Kubernetes annotation alone grants nothing. If you apply an annotation without a matching cloud-side rule, token exchange fails. If you add a cloud-side rule without the annotation, the Pod never receives the credentials.
EKS: IRSA or Pod Identity
EKS offers two mechanisms. IRSA uses the cluster's OIDC provider and the role trust policy. EKS Pod Identity moves the mapping into an EKS association between a namespace, a ServiceAccount, and a role. A node agent then hands out credentials. Pod Identity needs no per-cluster OIDC provider and no ServiceAccount annotation, which makes reuse across clusters simpler. IRSA works anywhere you can register an OIDC issuer, including self-managed clusters.
Choosing between approaches
- Use the mechanism your managed platform provides. Each one is tested with its provider's webhook and agents.
- For multi-cloud or self-managed clusters, use the OIDC federation each cloud supports. Publish the issuer's discovery document and keys where the cloud can reach them.
- Keep one ServiceAccount per workload and one cloud identity per ServiceAccount. Sharing identities makes least privilege impossible to audit.
Exercise
A Pod on AKS has the correct ServiceAccount annotation, but it receives no federated token and Azure calls fail with a missing credential. Which comparison point most likely explains this, and what do you check?
Show answer
AKS requires the Pod label azure.workload.identity/use: "true" in addition to the ServiceAccount annotation. Check that the Pod template carries the label. Then confirm that the federated credential's issuer, subject, and audience match the cluster and the ServiceAccount.