Course contentsShow
← Cloud and Infrastructure
Lesson 1468 of 2,98930. Managed Kubernetes ServicesFree lesson

IRSA: IAM Roles for Service Accounts

Granting AWS permissions to pods using service account annotations and OIDC provider.

IRSA: IAM Roles for Service Accounts

What you'll learn: How to grant fine-grained AWS permissions directly to Kubernetes pods using service account annotations and OIDC.

The Core Concept

IRSA (IAM Roles for Service Accounts) solves a critical problem: giving individual pods AWS permissions without sharing credentials or granting excessive permissions to all pods on a node.

Instead of embedding AWS credentials in your container or relying on EC2 instance profiles (which grant permissions to all pods on that node), IRSA uses OIDC (OpenID Connect) to let Kubernetes service accounts assume specific IAM roles.

How It Works

Think of IRSA like a valet parking ticket system. Your pod (the car owner) presents a service account token (the ticket) to AWS. AWS verifies this token with the EKS OIDC provider (the valet manager), then grants temporary credentials matching the IAM role you've annotated on the service account.

The magic happens through an annotation on your ServiceAccount:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-app-sa
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/MyAppRole

When pods use this service account, they automatically receive temporary AWS credentials mapped to MyAppRole. Your application code uses the AWS SDK normally—no hardcoded credentials needed.

The Benefits

Each service account can have different permissions. Your logging pod gets S3 write access, your database pod gets RDS permissions, and your frontend gets nothing—all running on the same nodes with proper isolation.

Key Takeaway: IRSA uses OIDC and service account annotations to grant specific IAM role permissions to individual pods, providing secure, fine-grained AWS access control without sharing credentials or using overly permissive node-level IAM roles.