kubernetesamazon-eksk8s-serviceaccount

EKS Service Account Annotation


I have a service account, and this needs access to multiple aws services. Is there any way we could specify multiple role an annotations, or do we expect to create a generic role and give access to all the required services?

The below not supported?

enter image description here

ChatGPT says,

apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-service-account
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::111111111111:role/my-role-1
    eks.amazonaws.com/role-arn: arn:aws:iam::111111111111:role/my-role-2


Solution

  • yes its not supported like what you shown.

    example supported:

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      annotations:
        eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/xxxx
    

    your options is to use 1 iam role arn like above, with multiple IAM policy attached. I don't think its hard to add multiple policy to a role.