-
Notifications
You must be signed in to change notification settings - Fork 216
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
[Bug]: kubernetes authentication method failing on AWS EKS #2942
Comments
Thanks for raising this @tstraley ! It has been a while since I implemented this, so taking me a hot minute to rebuild my context 😂 bare with me on this one. Just adding a bunch of context off the top of my head: If I remember correctly, the bit we have to workaround (the issuer mismatch) is simply that we instruct the The go-oidc library will return an error after it gets the discovery well-known endpoint if the host used to fetch that does not match the issuer URL in the response. We use the local k8s DNS address to get the discovery document, but it returns a JWKS URL and issuer that does not match that same local k8s DNS name. However, the go-oidc library will still use JWKs, which is what we're seeing here I believe. I think this is a form of this issue: aws/containers-roadmap#2234 This issue linked suggests a work-around for EKS is to actually start the discovery journey using the custom EKS OIDC address (e.g. You can currently change this in your Flipt configuration like so: authentication:
methods:
kubernetes:
enabled: true
discovery_url: "https://oidc.eks.<region>.amazonaws.com/id/<cluster-id>"
required: true Could you give this a try for us 🙏 If this works we can make a docs update to explain this edge case a bit better 💯 |
Haha great timing 🙌 |
Thanks @GeorgeMac -- this makes a lot of sense. I tried out your suggestion. First attempt was causing pod to crash on startup, but was eventually able to get relevant error (there were some red-herring "context closed" errors on a couple pod restarts masking this one):
This endpoint is one of AWS's public endpoints and uses a cert signed by
This started up fine, and now appears to be working properly! Please feel free to resolve and update docs as you see fit. Thanks for the help! |
That's amazing, thanks for raising this and working through it! I will open a docs issue before closing this, so we make sure to get these details in there for future folks. |
Bug Description
Config includes:
When attempting to make API call using a service account token to retrieve a flipt client token, it eventually returns an empty reply:
And the flipt service records this error:
It looks like there is an understanding in the code that the URL provided by the oidc well-known endpoint (in this case returning that
ip-172-16-173-141.ec2.internal
address) is not correct and the provided discovery URL (in this case the defaultkubernetes.default.svc.local
) should be used insteadflipt/internal/server/authn/method/kubernetes/verify.go
Line 87 in 7f36af3
Despite this attempt to handle this, the underlying oidc provider is calling the invalid URL which flipt cannot reach as part of this updateKeys call https://github.com/coreos/go-oidc/blob/22dfdcabd450013b4d51ac15b6423f529d957e9f/oidc/jwks.go#L230 which is in the 'Verify' codepath.
Version Info
v1.39.2
Search
Steps to Reproduce
Expected Behavior
Expected to be able to get a client token response as detailed in https://docs.flipt.io/authentication/methods#via-the-api
Additional Context
Running in AWS EKS
The text was updated successfully, but these errors were encountered: