-
Notifications
You must be signed in to change notification settings - Fork 705
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
Auth via Keycloak #4940
Comments
Hi, it seems you are successfully authenticated, but the token is not authorized somehow. There is a variety of reasons why it can fail; I'd recommend you have a look at the OIDC debugging docs as well as the guide for configuring Keycloak in Kubeapps. |
Hi @antgamdia, thank you a lot for the response. |
Hi @antgamdia, I get the same redirect loop because I use a single keycloak kubeapps client.
Why do you enforce an additional kubernetes client in keycloak when it's running on the same node? Please add a global admin user and password and replace step 2 in the getting-started tutorial. How to remove unused scopes like email and groups? |
Hi @kllp . The redirect loop was solved above by the original poster by following the linked debugging instructions. Were you able to work through those to see where the issue is? The normal case is that you are authenticating fine against your identity provider (keycloak) but the credential isn't valid for your cluster (usually a config issue), as was the case for the original poster. We don't enforce an additional OIDC client-id per kubernetes cluster - that's just recommended. You can choose to use the same client for both of your clusters.
I'm not sure what you mean here, sorry. I thought you were talking about the OIDC client-ids, but here it sounds like you're talking about user login details?
The getting started documentation intentionally does not include instructions for an integrated authentication system (such as Keycloak, or Dex) for the very reason that those authentication systems can be quite complex to setup, debug and integrate. That's why the getting started focuses on a demo setup using a service account, because it is simple to try out. We have documentation for the more complicated authentication integrations.
Do you mean in Keycloak? You would have to check their documentation, but generally I'm not sure why you would not be using those in the sense that, your cluster will be presented with a signed |
Thank you. I didn't read the entire debugging page.
Can you please explain why this is necessary and other cluster management tools don't need it?
My request to use a plain admin password is about not having to use integrated authentication systems. The 'quick' alternative involves a kubernetes token (you have to create a serviceaccount, a clusterrolebinding and a secret) which is not as easy as using predefined admin password or token. I tried to base64 encode a short custom token as serviceaccount secret, but obviously the token must have a fixed length.
I asked to keep the Keycloak configuration as simple as possible because it prevents configuration errors. |
👍
Remember, Kubeapps isn't a cluster management tool - we don't manage clusters, we allow users to browse a catalog of apps that they (the user, with whatever RBAC they've been assigned on the cluster - see users in Kubernetes) can install on the cluster (according to their RBAC on that cluster). I don't know which cluster management tool you might mean, but at a guess, perhaps those tools run with a privileged service account that already has the required permissions to do privileged actions. Kubeapps, on the other hand, allows users to only do what their (already defined) RBAC on the cluster allows. If you want to use OIDC for user authentication for Kubeapps, then the cluster must be able to trust the
Yes, that would be nice to be able to have available to make it easier to try out. I just don't know how we could do that safely - since I think it would require either:
Since we don't control the authentication systems trusted by the cluster, Kubeapps can't really do this. (We do do this in our development environment because we control the cluster creation and configuration).
That means that the Kubernetes cluster did not think your token is valid. I'd recommend letting Kubernetes create a valid serviceaccount secret for you (I've never tried or wanted to manually create one).
Sorry, I don't think I'm following what you mean. It's one thing to want to keep your Identity Provider configuration simple, but at the very least, it needs to be able to communicate to the cluster a user id and group id for an authenticated user in some form that the cluster can trust. All I meant was that normally the user email and group scopes of a signed I think you're saying that you wish authentication could be simpler: if so, I agree :) If you have implementation ideas for how it could be simpler for a demo Kubeapps instance that talks to a cluster (simpler than the service-account instructions we provide), I'm happy to discuss it :) |
Thank you very much for your quick and extensive reply!
You got it right and I now understand what you mean.
This is how I expected it to be because it's so common amongst different applications. Just use a plain admin user and password. Other than leaking credentials, there's no danger. |
Finally both keycloak clients work fine. Now I'm stuck at the last step where I need to allow users or groups access to namespaces.
but in kubeapps I still get the error Can you please tell me if this is the right way to provide the user |
Hi @kllp . That depends. Normally you would use an email claim for user identity (better uniqueness guarantees) rather than a name claim. Given that you say your user is called Once you know what info is on your signed
|
Thank you very much. I replaced
I prefer groups so I granted group access
The JWT token includes
so group-based access should work? How to debug this one? The default oidc-groups-prefix should be |
My browser dev tools show
|
That message means exactly what it says: the user Why do you have the
If you did already try without a prefix, all I can suggest is comparing your configuration with other tutorials about keycloak with k8s oidc... as I've not used KeyCloak. If you paste a screenshot of your keycloak group, your k8s api settings (if any) your RBAC, and then the output of |
It finally works. Thank you for pointing me to the I'm sorry, I misread the api server configuration options table. The third column says
Thank you for your support! |
Excellent! Glad you got it working :) |
Summary
I want to use Keycloak as IDP and the auth should be working but I get an error inside the kubeappsapi container...
In the logs I get an AuthSuccess message, but I get redirected back to the login page.
Background and rationale
I installed kubeapps via the bitnami helm chart.
Version: bitnami/kubeapps 8.1.11
Used custom values:
Description
After successful (?!) login, I get redirected back to the login page.
Additional context
kubeapps auth-proxy log:
kubeapps nginx log:
kubeapps api log:
The text was updated successfully, but these errors were encountered: