-
Notifications
You must be signed in to change notification settings - Fork 84
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
S3 Target does not work with IRSA (AWS role for svc acct) but works with static IAM User Creds #349
Comments
Thanks for reporting, I'll will check and let you know when I find something |
Thankyou @fjogeleit, for getting to this so quickly, and creating image This issue has can be closed (or closed when this gets released)
|
Great, thanks for your feedback and help with testing. |
Hi -
I have an instance of kyverno, and policy reporter deployed in AWS EKS.
Version:
Its deployed via ArgoCD, with its
valuesObject
values (values.yaml) as shown below.It basically sends events to S3. (i am separating audit and blocked events into diff path, based on
sources
, in diffchannels
, TMI). If i pass it hardcoded AWS IAMUser's credssecretAccessKey
andaccessKeyID
all works This is great, everything is working.However, i would like to use IRSA which is basically an AWS IAM Role, linked with a k8s service account. For this to work, in short, i create (a) AWS OIDC provider (b) AWS role (c) k8s service account, and 'annotation' the service account to use said role. That generates some environment variables (AWS_DEFAULT_REGION, AWS_REGION, AWS_ROLE_ARN, AWS_STS_REGIONAL_ENDPOINTS, AWS_WEB_IDENTITY_TOKEN_FILE). I then turned on debug logging as well. I then started policy-report deployment/pod, all good still.
I then triggered an event, but get some violation error 'Privileged mode is disallowed'. It looks like policy reporting is getting
"WebIdentityErr: failed to retrieve credentials
. Putting the error together, it looks like the messages is trying to sayMethodNotAllowed - The specified method is not allowed against this resource POST
. Seems to be getting errors around here:policy-reporter/pkg/target/s3/s3.go
Line 56 in 9036018
Complete log below.
What i tried to debug
use a diff pod with same role - the other pod worked
For completeness sake, i then created another deployment / another service account, that uses the same role, and that works. I diffed the environment variable provided to both deployment, and they were the same.
shell to check via awscli or soemthing (couldn't)
I also tried get into the pod
kubectl exec --stdin --tty kyverno-policy-reporter-c6c864d49-bx658 -- /bin/bash
to test, but can't, as it seems there isn't a shell in thescratch
base image.policy-reporter/Dockerfile
Line 18 in 9036018
Ensure AWS IAM permissions are the same - done
Finallly, worth mentioning, both the IAMuser and the IAMRole has the AWS managed policy
AmazonS3FullAccess
/Testing prebuild version 2.16.2
I was follow on this issue / comment: #327 (comment). I think the referenced issue is more "when" do we use which creds... not why we are getting
WebIdentityErr
. In anycase2.16.2
image did not help in my case. (Tested by switching just the image key)The ask
Why does upload to s3 works when using IAMUser status creds, but not IRSA role creds?
Please let me know if i can provide any additional information.
Thanks
The text was updated successfully, but these errors were encountered: