Skip to main content
A Kubernetes pod or other in-cluster workload can call AWS APIs by obtaining AWS credentials. Historically, solutions like kube2iam and kiam provided this by intercepting EC2 instance metadata requests or using node-level IAM roles. Those approaches work, but they diverge from Kubernetes’ native identity model: ServiceAccounts. IAM Roles for Service Accounts (IRSA) resolves this by letting a Kubernetes ServiceAccount assume an AWS IAM role. Workloads authenticate to the Kubernetes API using the ServiceAccount token, and that bound token is exchanged with AWS STS (via AssumeRoleWithWebIdentity) to receive short-lived AWS credentials. This aligns pod identity with Kubernetes best practices and avoids annotating individual pods with AWS permissions. Helpful references:

How IRSA works (summary)

At runtime:
  1. The pod requests a bound service account token (a projected JWT) from the Kubernetes TokenRequest API.
  2. The pod sends that JWT to AWS STS using AssumeRoleWithWebIdentity, specifying the IAM role ARN.
  3. STS validates the JWT against the role’s trust policy (which references the cluster OIDC provider and constrains sub claims).
  4. If valid, STS returns temporary AWS credentials that the pod uses to call AWS services (S3, DynamoDB, etc.).
  5. When credentials expire the pod repeats the token + STS flow to refresh them.

Key components required for IRSA

Quick example: ServiceAccount YAML

Create a ServiceAccount and annotate it with the IAM role ARN. The pod that uses this ServiceAccount gets a projected token it can exchange for AWS credentials.

Example IAM trust policy (simplified)

This trust policy shows an IAM role that allows sts:AssumeRoleWithWebIdentity for a specific cluster OIDC provider and service account (system:serviceaccount:prod:my-app):
A system architecture diagram titled "Scalability Concerns and Limitations" showing how EKS clusters use OIDC/IRSA, a webhook, AWS IAM/STs and service accounts to grant pods access to AWS S3. It illustrates token and permission flows between OIDC, webhook, STS/IAM, nodes/pods, and S3.

High-level sequence (step-by-step)

  1. Create or register the cluster OIDC provider in the AWS account (EKS exposes the issuer URL after cluster creation).
  2. Create an IAM role whose trust policy lists the OIDC provider as the Federated principal and permits sts:AssumeRoleWithWebIdentity. Constrain sub to the service account(s) that should assume the role.
  3. Create a Kubernetes ServiceAccount annotated with the role ARN (annotation eks.amazonaws.com/role-arn).
  4. Deploy pods that use that ServiceAccount. Pods request a bound token from the TokenRequest API and exchange it with STS.
  5. STS validates the token and returns temporary credentials. The pod uses these credentials to call AWS APIs.
  6. Token/credential rotation is handled by repeating the TokenRequest + STS exchange when credentials expire.

Operational and scale considerations

  • OIDC provider limits: AWS accounts have limits on the number of IAM OIDC providers you can register. If you run many clusters in a single account, you must plan for OIDC provider limits and account boundaries.
EKS automatically exposes the cluster OIDC issuer URL after cluster creation. Register that issuer as an IAM OIDC provider for the AWS account that will manage the IAM roles.
  • Bootstrapping and automation: The cluster OIDC issuer URL is available only after cluster creation. Automated CI/CD flows that attempt to fully provision IAM roles before cluster creation should instead create the cluster first (or delay role trust policy creation until the OIDC provider is known).
If your provisioning pipelines create IAM roles up-front, update them to create the cluster (and register the cluster OIDC provider) before creating role trust policies that reference the OIDC provider.
  • Cross-cluster reuse and multi-account designs: Since IAM is per-account, reusing a single IAM role across multiple clusters requires trusting multiple OIDC providers or making broader trust policies. Both options increase complexity and may widen blast radius. Consider one role per cluster/namespace pattern for clearer boundaries.
  • Runtime and refresh behavior: IRSA provides short-lived credentials via STS. Ensure workloads handle credential rotation or use AWS SDKs with automatic refresh support.

Management implications

  • Alignment with Kubernetes: IRSA maps AWS permissions into Kubernetes ServiceAccounts, improving auditability and reducing pod annotation sprawl.
  • Added AWS-side configuration: You must manage OIDC providers and trust policies in IAM, which introduces operational overhead when managing many clusters or regions.
  • Alternatives: Node-scoped IAM (kube2iam/kiam) gives coarser-grained control (node-level) and may be simpler for small deployments. Newer EKS pod-identity integrations and community projects continue to evolve, offering different trade-offs.
A presentation slide titled "Management and Maintenance Challenges" showing a world map with multiple colored boxes labeled "EKS Cluster" in different regions. It also shows an AWS IAM icon, ARN/STS labels and arrows illustrating cross-region access and identity/permission flows.

Alternatives and future directions

IRSA was an important step to unify Kubernetes service accounts with AWS IAM. Since then, AWS and the community have introduced additional pod identity integrations for EKS and other orchestration approaches. Evaluate trade-offs based on scale, operational model, and security posture:
  • Use IRSA when you want fine-grained pod-level IAM permissions mapped directly to ServiceAccounts.
  • Consider node-scoped approaches (kube2iam, kiam) for simpler, smaller clusters where node-level scoping is acceptable.
  • Explore EKS-native pod-identity integrations or newer community projects if they reduce operational overhead for your environment.
A presentation slide titled "Alternative Solutions and Recommendations." It shows the text "Pod Identity" with a plus sign next to an EKS/Kubernetes logo labeled "EKS."
Pod identity topics and a deeper comparison of IRSA vs. other pod identity projects are covered in separate documentation.

Watch Video