`An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Not authorized to perform sts:AssumeRoleWithWebIdentity` from an IRSA pod
IntermediateTroubleshootingCloud identity: IRSA, Workload Identity and CI OIDC
Answer
Likely causes → The role's trust policy does not match the token. The sub condition names a different namespace or SA, the OIDC provider ID belongs to another cluster, or aud is not sts.amazonaws.com.
Diagnose →
kubectl exec deploy/api -- cat /var/run/secrets/eks.amazonaws.com/serviceaccount/token \
| cut -d. -f2 | base64 -d 2>/dev/null | jq '{iss,sub,aud}'
aws iam get-role --role-name api-prod --query Role.AssumeRolePolicyDocument
Fix →
"Condition": { "StringEquals": {
"oidc.eks.ap-south-1.amazonaws.com/id/ABC123:sub": "system:serviceaccount:prod:api",
"oidc.eks.ap-south-1.amazonaws.com/id/ABC123:aud": "sts.amazonaws.com"
}}
Prevent → Generate trust policies from the SA name and namespace in a Terraform module, never by hand.
More on Cloud identity: IRSA, Workload Identity and CI OIDC
A pod configured for IRSA runs `aws sts get-caller-identity` and gets the node role (`eks-node-group-role`) instead of its own roleBeginner`InvalidIdentityToken: No OpenIDConnect provider found in your account for https://oidc.eks.ap-south-1.amazonaws.com/id/ABC123`BeginnerIRSA env vars are present in the pod, but one legacy service still uses the node roleIntermediatePods without IRSA can still call AWS with the node's permissions through `169.254.169.254`IntermediateWith EKS Pod Identity, the pod gets `Unable to locate credentials` even though a pod identity association existsIntermediate`aws-actions/configure-aws-credentials` fails with `Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers`Beginner