Skip to main content

Overview

IAM Roles for Service Accounts (IRSA) allows Kubernetes service accounts to assume AWS IAM roles, enabling secure access to AWS services without storing credentials in the cluster. This guide covers setting up IRSA for:
  • Cluster Autoscaler
  • EFS CSI Driver
  • EBS CSI Driver

Prerequisites

1

OIDC Provider

Your EKS cluster must have an OIDC provider enabledCheck if enabled:
2

Enable OIDC (if needed)

Cluster Autoscaler IRSA

The Cluster Autoscaler needs permissions to modify Auto Scaling Groups.

Create IAM Policy

Create a policy document:
cluster-autoscaler-policy.json
Create the policy:
Note the policy ARN from the output.

Create Service Account with IAM Role

Using eksctl:
Replace YOUR_ACCOUNT_ID with your AWS account ID.

Verify Service Account

Look for the annotation:

Update Helm Values

Configure the Cluster Autoscaler to use this service account:
values.yaml

EFS CSI Driver IRSA

Required for shared file storage (model caching).

Create IAM Policy

Download the policy:
Create the policy:

Create Service Account with IAM Role

Install EFS CSI Driver

Update the deployment to use the service account:

Verify

EBS CSI Driver IRSA

Required for block storage (PersistentVolumes).

Create IAM Policy

The policy is available from AWS:

Create Service Account with IAM Role

Install EBS CSI Driver Addon

Verify IRSA Configuration

Check Service Accounts

List all service accounts with IAM role annotations:

Test IAM Role Assumption

Create a test pod:
test-pod.yaml
Apply and exec:
Should show the assumed role ARN.

Troubleshooting

Role Not Assumed

Check service account annotation:
Should show:

Permission Denied

Verify IAM policy:
Check trust relationship:
Should include trust policy for OIDC provider.

OIDC Provider Issues

Verify OIDC provider exists:
Re-associate if needed:

Best Practices

Grant only the minimum permissions required for each service account.Review and audit IAM policies regularly.
Create separate IAM roles for each service account rather than sharing roles.This improves security and auditability.
Monitor IAM role usage via CloudTrail:
Tag IAM roles and policies for easier management:

Complete Example

Here’s a complete script to set up all IRSA roles:
setup-irsa.sh
Make executable and run:

What’s Next?

GPU Nodes

Optimize GPU node configuration

Cluster Autoscaler

Configure cluster autoscaling