π Part 1 β IRSA vs EKS Pod Identity (Clear Comparison)
First β say this in interview:
Both IRSA and Pod Identity solve the same problem: giving pods AWS permissions without using node IAM role or static keys β but they use different mechanisms.
Thatβs a strong start.
β What Problem Both Solve
Without IRSA/Pod Identity:
Pod β uses node IAM role β‘ every pod gets same permissions β‘ huge blast radius risk β
Both solutions give: β pod-level IAM β least privilege β no static credentials β auditable access
π₯ IRSA β IAM Roles for Service Accounts
IRSA = OIDC + STS + ServiceAccount token method
Flow:
ServiceAccount β OIDC token β STS AssumeRoleWithWebIdentity β temp creds
β IRSA Characteristics
- Uses Kubernetes OIDC issuer
- Uses projected service account token
- Pod calls STS directly
- No agent required
- Mature & widely used
- Works everywhere EKS supports OIDC
- Fully AWS-native method
π EKS Pod Identity (Newer Model)
Pod Identity = agent-based credential vending
Flow:
Pod β Pod Identity Agent β EKS control plane β STS β creds
β Pod Identity Characteristics
- Uses node agent (DaemonSet)
- Does not require OIDC provider setup
- Simpler config
- Central credential broker
- AWS-managed control plane integration
- Less token plumbing visible
βοΈ IRSA vs Pod Identity β Interview Comparison Table (in words)
Say this verbally:
IRSA
- OIDC based
- no agent
- pod talks to STS
- more setup
- very mature
- fully transparent flow
Pod Identity
- agent based
- simpler setup
- control plane mediated
- newer feature
- easier for teams
- less moving parts for users
π§ Interview Positioning Answer
If asked βwhich would you choose?β
Say:
Today I default to IRSA because itβs mature and widely adopted, but for new clusters I evaluate Pod Identity for simpler operational setup β especially when platform teams want centralized credential brokering.
That sounds balanced and senior.
πͺͺ Part 2 β What is OIDC (In EKS Context)
Donβt give textbook OAuth speech. Interviewers want EKS-specific OIDC.
β What is OIDC here?
OIDC = identity token issuer standard using signed JWT tokens.
In EKS:
Kubernetes API server acts as an OIDC issuer for service accounts.
Each cluster exposes:
https://oidc.eks.<region>.amazonaws.com/id/<cluster-id>This is a public identity provider endpoint.
β What It Issues
Kubernetes issues signed JWT tokens for service accounts.
Token contains:
- service account name
- namespace
- audience
- expiry
- issuer
These tokens are cryptographically signed.
β Why AWS Trusts It
You register this OIDC issuer with IAM as an OIDC identity provider.
IAM then trusts tokens signed by that issuer.
That trust enables STS web identity role assumption.
π Part 3 β What is STS AssumeRoleWithWebIdentity
This is the core of IRSA. Many candidates fail here.
β Definition (Interview Style)
AssumeRoleWithWebIdentity is an STS API that allows a role to be assumed using an external OIDC/JWT token instead of AWS credentials.
No AWS keys required.
β IRSA Flow β Step by Step (Say This in Interview)
1οΈβ£ Pod runs with ServiceAccount 2οΈβ£ Kubernetes injects OIDC JWT token file 3οΈβ£ Pod calls STS AssumeRoleWithWebIdentity 4οΈβ£ STS validates token against IAM OIDC provider 5οΈβ£ Trust policy matches subject 6οΈβ£ STS returns temporary AWS credentials 7οΈβ£ SDK uses creds automatically
Thatβs the full chain.
π Trust Policy Example Logic (Conceptual)
Role trust policy says:
βAllow assume role if:
- token issuer = this cluster OIDC
- subject = this service account
- namespace = this namespaceβ
This is how least privilege is enforced.
π Why This Is Secure
β Security Properties
- short-lived tokens
- cryptographically signed
- scoped to service account
- no stored secrets
- no node-role sharing
- fully auditable in CloudTrail
β οΈ Common Interview Trap β Node Role vs IRSA
If interviewer asks:
βWhy not just use node IAM role?β
Answer:
Because that gives every pod the same AWS permissions. A single pod compromise becomes full node privilege escalation. IRSA/Pod Identity reduces blast radius to pod level.
Strong answer.
𧨠Real Failure Modes (Bonus Interview Points)
Mention these = senior signal:
- OIDC provider not created β IRSA fails
- wrong audience field β STS reject
- trust policy subject mismatch
- token expired β auth errors
- clock skew issues
- service account annotation wrong
π§ One-Shot Senior Interview Summary Answer
If they ask open-ended:
βExplain IRSA, OIDC, and web identity STS together.β
Say:
In EKS, IRSA uses the clusterβs OIDC issuer to generate signed service account tokens. IAM trusts that OIDC provider. Pods present the token to STS using AssumeRoleWithWebIdentity, which validates the token and issues temporary credentials for the mapped IAM role. That gives pod-level least-privilege AWS access without static keys or node-role overexposure.
β Scenario 1 β Access S3 from Pod using IRSA (IAM Roles for Service Accounts)
IRSA works by:
- Linking Kubernetes ServiceAccount β IAM Role
- Using OIDC federation
- Pod gets AWS creds via projected token + STS AssumeRoleWithWebIdentity
Step 0 β Preconditions
- EKS cluster exists
- kubectl configured
- AWS CLI configured
- You have cluster admin access
Step 1 β Enable OIDC provider for EKS cluster
Check if exists:
aws eks describe-cluster --name <cluster-name> \
--query "cluster.identity.oidc.issuer" --output textAssociate OIDC provider (if not already):
eksctl utils associate-iam-oidc-provider \
--cluster <cluster-name> \
--approveStep 2 β Create IAM policy for S3 access
Example: read access to one bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject","s3:ListBucket"],
"Resource": [
"arn:aws:s3:::my-app-bucket",
"arn:aws:s3:::my-app-bucket/*"
]
}
]
}Create it:
aws iam create-policy \
--policy-name eks-s3-read \
--policy-document file://policy.jsonStep 3 β Create IAM role for ServiceAccount
Using eksctl (simplest):
eksctl create iamserviceaccount \
--name s3-sa \
--namespace default \
--cluster <cluster-name> \
--attach-policy-arn arn:aws:iam::<acct>:policy/eks-s3-read \
--approveThis does:
- Creates IAM role
- Adds trust policy with OIDC
- Annotates ServiceAccount
Step 4 β Verify ServiceAccount annotation
kubectl get sa s3-sa -o yamlYou should see:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::<acct>:role/...Step 5 β Use SA in Pod spec
apiVersion: v1
kind: Pod
metadata:
name: s3-test
spec:
serviceAccountName: s3-sa
containers:
- name: app
image: amazon/aws-cli
command: ["sleep","3600"]Step 6 β Test inside pod
kubectl exec -it s3-test -- sh
aws s3 ls s3://my-app-bucketDone. Thatβs IRSA working.
β Scenario 2 β Access S3 using EKS Pod Identity (Newer Method)
Blunt truth: This is operationally cleaner than IRSA. No OIDC fiddling. No SA annotations. AWS manages the credential injection via a Pod Identity Agent.
Pod Identity works by:
- EKS control plane + Pod Identity Agent
- IAM role bound directly to k8s ServiceAccount
- Uses EKS credential service instead of STS web identity token
Step 0 β Preconditions
- EKS version supports Pod Identity
- AWS CLI updated
- Add-on install allowed
Step 1 β Install Pod Identity Agent addon
aws eks create-addon \
--cluster-name <cluster-name> \
--addon-name eks-pod-identity-agentVerify:
kubectl get pods -n kube-system | grep pod-identityStep 2 β Create IAM role for pod
Trust policy is different from IRSA β uses pods.eks.amazonaws.com
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "pods.eks.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}Create role:
aws iam create-role \
--role-name eks-pod-s3-role \
--assume-role-policy-document file://trust.jsonAttach S3 policy:
aws iam attach-role-policy \
--role-name eks-pod-s3-role \
--policy-arn arn:aws:iam::<acct>:policy/eks-s3-readStep 3 β Create Pod Identity Association
This is the key step (no annotation needed):
aws eks create-pod-identity-association \
--cluster-name <cluster-name> \
--namespace default \
--service-account s3-sa \
--role-arn arn:aws:iam::<acct>:role/eks-pod-s3-roleStep 4 β Create ServiceAccount (plain)
apiVersion: v1
kind: ServiceAccount
metadata:
name: s3-sa
namespace: defaultNo annotations. Nothing fancy.
Step 5 β Pod spec same as before
spec:
serviceAccountName: s3-saStep 6 β Test
kubectl exec -it s3-test -- aws s3 lsWorks.
βοΈ IRSA vs Pod Identity β Real Differences (No Marketing Talk)
πΉ Setup Complexity
IRSA
- Needs OIDC provider
- Needs trust policy with condition keys
- Needs SA annotations
- More moving parts
Pod Identity
- No OIDC
- No annotations
- Single AWS association command
- Cleaner
Winner β Pod Identity
πΉ Maturity
IRSA
- Production proven for years
- Used everywhere
- Tooling ecosystem supports it
Pod Identity
- Newer
- Still rolling into org standards
- Some enterprises not fully migrated yet
Winner β IRSA (today)
πΉ Security Model
Both are strong if configured correctly.
But mistakes happen more with IRSA because:
- Wrong trust conditions
- OIDC misbinding
- Copy-paste policies
Pod Identity removes many human error points.
Winner β Pod Identity
πΉ Multi-cluster / Cross-account
IRSA:
- Easier to design complex federation
Pod Identity:
- Currently more cluster-local oriented
Winner β IRSA
πΉ Operational Burden
IRSA:
- More YAML + IAM glue
- More debugging pain
Pod Identity:
- Less cognitive load
- Easier onboarding for teams
Winner β Pod Identity