amazon-s3kubernetesamazon-iamkubernetes-pods3fs

How to access Amazon S3 bucket to the Kubernetes pods using IAM roles instead of Access key & secret keys?


I am trying to mount S3 bucket using s3fs-fuse to the Kubernetes pod. My S3 bucket is protected by IAM roles and i dont have Access Keys and Secret Keys to access S3 bucket. I know how to access a S3bucket from the Kubernetes pod using Access & Secrets Keys, but how do we access S3 bucket using IAM roles ?

Does anyone has suggestion on doing this ?


Solution

  • You use the IRSA system, attaching an IAM role to a Kubernetes service account and then attaching that K8s SA to your pod. See https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html for a starting point.