-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use an aws role arn (irsa) while still loading the webIdenityToken from a file #2509
Comments
Thanks for opening this issue 👍. The team will review it shortly. If this is a bug report, make sure to include clear instructions how on to reproduce the problem with minimal reproducible examples, where possible. If this is a security report, please review our security policy as outlined in SECURITY.md. If you haven't already, please take a moment to review our project's Code of Conduct document. |
In addition I think it would need to add the |
cc @hairyhum |
hi @clayrisser , I think I need your help to understand better the scenario being described here 😄 My question is whether or not the description below is the same set up that you are using? If not maybe we are missing a third use case! TL,DR: Kanister is already checking for Long explantion:
You are absolutely right that when IRSA is used, there shouldn't be a need to manually supply for Web Identity Token because the token should be requested and stored by the Additionally, if running on EKS clusters, the Amazon EKS Pod Identity Webhook watches for Pods that use a K8s Service Account annotated with The scenario with Amazon EKS Pod Identity Webhook above is what the function fetchWebIdentityTokenFromFile accounts for. (Albeit that is actually not the best function name 😅 ) Which means the statement below is true, however the environment variables configuration part should be done by Amazon EKS Pod Identity Webhook on behalf of the Pod, and there should not be any additional work from user beside setting up (step 1, 2, and 3 here)
So going back to the bugfix suggestion:
This is entirely the intention of the caller function authenticateAWSCredentials which calls fetchWebIdentityTokenFromConfig and fetchWebIdentityTokenFromFile successively.
And checking for a token located at |
Ok, so it works with irsa? Do you have any examples? |
@clayrisser there are no examples to demonstrate this specific behaviour, but what you can do is to create a KubeTask function in your blueprint and specify
If the pod is created in EKS and credentials injection is properly set up, you should get the role for the service account you're requesting. |
When configuring an application with IAM roles for service accounts (IRSA) in a Kubernetes environment, you should not need to manually supply the Web Identity Token in your configuration. This token is dynamically generated and injected into your pod by the EKS environment.
The token should be loaded from a file.
https://github.com/kanisterio/kanister/blob/master/pkg/aws/aws.go#L132
I see that there is an option to load the webIdenityToken from a file, but that only works when configured using ENVs.
https://github.com/kanisterio/kanister/blob/master/pkg/aws/aws.go#L105
It should be possible to use an aws role arn (irsa) while still loading the webIdenityToken from a file.
My proposed solution is that instead of returning
nil, nil
when a webIdenityToken is not found, simply check to see if it's located at/var/run/secrets/eks.amazonaws.com/serviceaccount/token
first.https://github.com/kanisterio/kanister/blob/master/pkg/aws/aws.go#L126
The text was updated successfully, but these errors were encountered: