Skip to content

Support for IAM Roles for Service Accounts for EKS #254

Closed

Description

@sudip-moengage

Is your feature request related to a problem? Please describe.
It is not a problem for me, for now I'll create access key and secret but would like to have support for IAM roles, so that only pods have needed iam role for the S3 output pligin or cloudwatch output plugin

Additional context
https://aws.amazon.com/blogs/opensource/introducing-fine-grained-iam-roles-service-accounts/

Activity

  1. ahma commented on Dec 7, 2019

    @ahma
    Contributor

    I think the S3 output now has all the needed properties. Since the last release we added all the missing auth configs to cloudwatch output #273 .You can change the fluentd service account if you want. I'm going to close this ticket, but if you are missing anything please reopen it, and let us know.

  2. sudip-moengage commented on Dec 9, 2019

    @sudip-moengage
    Author

    @ahma I couldn't test it, but I checked #273, I'm not proficient with go, but I can see support for assume instance role is there, which the pod can inherit from node.

    But this issue is about kubernetes service account integration with AWS IAM roles. In short we do following:

    • In AWS create roles with following policy:
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Federated": "${OIDC_ARN}"
          },
          "Action": "sts:AssumeRoleWithWebIdentity",
          "Condition": {
            "StringEquals": {
              "${OIDC_URL}:sub": "system:serviceaccount:${NAMESPACE}:${SA_NAME}"
            }
          }
        }
      ]
    }
    • In kubernetes we need to create a service account and annotate it with the role and use this service account in pods.

    Then EKS automatically adds AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE (volume mount) env variable to pod. So, we need support for assuming roles via web identity token.

  3. ahma commented on Dec 9, 2019

    @ahma
    Contributor

    Thanks @sudip-moengage , I will look into this. -> reopen

  4. reopened this on Dec 9, 2019
  5. self-assigned this
    on Dec 9, 2019
  6. added this to the 2.8.0 milestone on Dec 9, 2019
  7. ahma commented on Dec 20, 2019

    @ahma
    Contributor

    @sudip-moengage In this case you can annotate the SA If you annotate the fluentd/fluentdbit resources Docs

  8. removed this from the 2.8.0 milestone on Dec 20, 2019
  9. sudip-moengage commented on Dec 30, 2019

    @sudip-moengage
    Author

    @ahma Yes, I can annotate but, the SDK fluentd uses, does it support sts:AssumeRoleWithWebIdentity?

  10. bonifaido commented on Jan 7, 2020

    @bonifaido
    Contributor

    Hi @sudip-moengage,

    the root cause for this issue is that the AWS Ruby SDK in the latest fluentd-s3-plugin doesn't support those environment variables injected by EKS in this case (AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE).

    Please follow fluent/fluent-plugin-s3#301 for further details. Once that plugin gets updated with a more up-to-date AWS Ruby SDK this will work automagically in more recent release of that plugin.

    We can't solve this issue from the logging-operator, so I'm closing this now.

  11. bonifaido commented on Jan 10, 2020

    @bonifaido
    Contributor

    @sudip-moengage just submitted fluent/fluent-plugin-s3#305 to resolve the issue upstream, I hope it gets merged soon enough 🙂

  12. gregorygtseng commented on Jun 10, 2020

    @gregorygtseng

    Correct me if I'm wrong, but I don't think the CRD supports annotating the ServiceAccount for fluentd; it only allows annotations on the fluentd pods themselves, or naming a different SA.

  13. kostyaplis commented on Apr 21, 2021

    @kostyaplis

    @gregorygtseng seems that you are right. Having annotation set as fluentd.annotations annotates a fluentd pod, but not service account. Is there a way to let operator set SA annotation?

  14. pepov commented on Apr 21, 2021

    @pepov
    Member

    no, currently you cannot

  15. kostyaplis commented on Apr 22, 2021

    @kostyaplis

    @pepov thanks for prompt reply
    Shall we reopen this issue then?
    I confirm that SA annotation is the only missing feature to fully support IRSA for EKS.

  16. reopened this on Apr 22, 2021
  17. prein commented on Apr 20, 2023

    @prein

    Need help understanding what the conclusion is here. Is assuming roles via web identity token supported? Does it work for anyone? If so, would you mind sharing an example working config?

  18. locked and limited conversation to collaborators on Apr 24, 2023
  19. converted this issue into a discussion #1314 on Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions