-
Notifications
You must be signed in to change notification settings - Fork 404
Issue with SSM and OpenIDConnect provider on version 4.1.0+ #442
Comments
@Flydiverny thanks for the fast response. Yes, I am using IAM role. Moreover my case is a bit more complex. IAM role assigned to the Service Account is used to assume role mentioned in the ExternalSecret. And it worked perfectly before 🤨 |
Hmm.. so I take it the old code worked as well (obviously). If I understand correctly, before there was a need for the pod's iam role to have a trust relation ship with While now the trust relationship would need to be from OIDC with There was some discussion in #254 for fargate support which seemed to have extra needs for the changes introduced. @lukaszbudnik @dalgibbard any thoughts? |
This was kinda why I originally put it behind a Fargate flag / envvar, in case this usage breaks other edge cases. |
Yeah! Have to say that now I'm confused why fargate needed this change to begin with! Are you setting |
Ermm I'd have to check the code to give a comment with all the right terminology 😅 but i created a service account with the role needed as per the helm chart, and then deployed external-secrets without it creating the service account etc. |
I allowed myself to dig a bit and it looks like this statement may be wrong (cc: @lukaszbudnik). The problem is that for non-Fargate EKS, the env var At this point, I'm not sure what's the best solution. I believe that trying to distinguish if we run Fargate vs EC2 worker node may be a bad idea (I'm even not sure if it's possible right now). I think (this)[https://aws.amazon.com/blogs/opensource/introducing-fine-grained-iam-roles-service-accounts/] wall of text may be useful. |
Yeap that sounds right. This is why I'm not convinced that the current implementation (if Web Identity is present, use it always) is the right way to do it. |
I'll see if I can get a test cluster up using fargate if I get some time on my hands. |
i'd like to chime in here as i'm struggling with the same thing (or at least something closely related). i'm using i have a eks.amazonaws.com/role-arn: arn:aws:iam::111111111111:role/external-secrets in my assumeRole: arn:aws:iam::222222222222:role/secret-reader but doing that lead to: {"level":50,"time":1595648005611,"pid":17,"hostname":"external-secrets-c79f97985-gvw9q","message":"Not authorized to perform sts:AssumeRoleWithWebIdentity","code":"AccessDenied","time":"2020-07-25T03:33:25.611Z","requestId":"5f8c8963-885c-4318-b6b1-556a3f9abd05","statusCode":403,"retryable":false,"retryDelay":65.78212229463618,"stack":"AccessDenied: Not authorized to perform sts:AssumeRoleWithWebIdentity\n at Request.extractError (/app/node_modules/aws-sdk/lib/protocol/query.js:50:29)\n at Request.callListeners (/app/node_modules/aws-sdk/lib/sequential_executor.js:106:20)\n at Request.emit (/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)\n at Request.emit (/app/node_modules/aws-sdk/lib/request.js:683:14)\n at Request.transition (/app/node_modules/aws-sdk/lib/request.js:22:10)\n at AcceptorStateMachine.runTo (/app/node_modules/aws-sdk/lib/state_machine.js:14:12)\n at /app/node_modules/aws-sdk/lib/state_machine.js:26:10\n at Request.<anonymous> (/app/node_modules/aws-sdk/lib/request.js:38:9)\n at Request.<anonymous> (/app/node_modules/aws-sdk/lib/request.js:685:12)\n at Request.callListeners (/app/node_modules/aws-sdk/lib/sequential_executor.js:116:18)","type":"Error","msg":"failure while polling the secret default/secretsmanager-example"} i have all the iam wiring set up for irsa to work and to allow so as i understand it, fwiw, the irsa part totally works: as long as i don't add just for giggles i also tried adding the eks oidc provider to the target account and using an assume role policy that would allow a straight-up irsa-style but since |
@sdickhoven Yepp! Sounds right :) Work around is to use 4.0.0 for the time being. |
Is it fair to suggest that we should push the WebIdentity option behind an environment variable / parameter? Any reasons against this? |
...just to confirm: v4.0.0 fixes the problem and cross-account (no |
@dalgibbard I think I'll need some more insight in your setup. I've now done some trial runs using EKS Fargate. That gives you a new eks cluster using fargate, as well as setting up a role for OIDC which can be used by your service account, in my case the role Then I also tried in combination with setting Creating a new IAM role {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111:role/eksctl-fargate-test-kes-iamserviceaccount-role"
},
"Action": "sts:AssumeRole"
}
]
} the secret that needs an alternative role: apiVersion: 'kubernetes-client.io/v1'
kind: ExternalSecret
metadata:
name: hello-service-with-role
spec:
backendType: secretsManager
roleArn: arn:aws:iam::1111111111:role/assume-this-role
data:
- key: hello-service/password
name: password This gives me the correct expected output: [1595814400855] DEBUG : spinning up poller for default/hello-service-with-role
[1595814400857] INFO : starting poller for default/hello-service-with-role
[1595814401023] DEBUG : next poll for default/hello-service-with-role in 0 ms
[1595814401023] INFO : running poll on the secret default/hello-service-with-role
[1595814401193] INFO : fetching secret property hello-service/password with role: arn:aws:iam::111111111:role/assume-this-role
[1595814402799] INFO : upserting secret default/hello-service-with-role
[1595814402969] DEBUG : updating status for default/hello-service-with-role to: SUCCESS #453 restores the old behavior I've pushed a docker image for testing here And tested it with the helm chart values: env:
AWS_REGION: eu-west-1
AWS_DEFAULT_REGION: eu-west-1
DISABLE_POLLING: true
LOG_LEVEL: debug
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::111111111:role/eksctl-fargate-test-kes-iamserviceaccount-role
image:
repository: flydiverny/kuberenetes-external-secrets
tag: pr-453
securityContext:
fsGroup: 65534 |
That is curious tbh. I've dropped EKS Fargate from our project due to lacking centralised logging options. |
Hey.
Below issue does not occur on version 4.0.0. This error occurs only on 4.1.0+
External secret definition:
Error in external secrets pod:
The text was updated successfully, but these errors were encountered: