如何使用 IAM 角色而不是访问密钥和秘密密钥将 Amazon S3 存储桶访问到 Kubernetes pods?

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

我正在尝试使用 s3fs-fuse 将 S3 存储桶挂载到 Kubernetes pod。我的 S3 存储桶受 IAM 角色保护,我没有访问密钥和秘密密钥来访问 S3 存储桶。我知道如何使用访问和秘密密钥从 Kubernetes pod 访问 S3bucket,但我们如何使用 IAM 角色访问 S3 存储桶?

有没有人对此有建议?

您使用 IRSA 系统,将 IAM 角色附加到 Kubernetes 服务帐户,然后将该 K8s SA 附加到您的 pod。请参阅 https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html 作为起点。