Kubernetes Dashboard fails to authorise with group-based RBAC
What happened
I wanted to assign RBAC to users accessing my user cluster in KKP. Since they are all in OIDC groups and the KKP setup has OIDC for user clusters enabled, I only assigned group-based RBAC. When those users that only have access via group-based RBAC try to use the Kubernetes Dashboard built into KKP, they are getting errors insinuating that they do not have proper permissions:
nodes is forbidden: User "[email protected]" cannot list resource "nodes" in API group "" at the cluster scope
However, the same users can access the cluster via an OIDC-based kubeconfig downloaded from the KKP dashboard just fine. As a example from the error above: Accessing the list of nodes (and any other resources) works via kubectl, but not via the Kubernetes Dashboard (proxy). The dashboard stays empty.
Expected behavior
OIDC access via kubectl / kubeconfig or Kubernetes Dashboard based access should be consistent, my users should have access to the same resources via the Kubernetes Dashboard just based on group permissions.
How to reproduce
- Sign into KKP (e.g. dev) with an OIDC provider that has groups. In our example, GitHub. Make sure the setup supports OIDC for user clusters.
- Create a user cluster, enable Kubernetes Dashboard during the setup. Wait for the user cluster to finish deploying.
- Go to "RBAC" tab at the bottom, switch to "User". Remove the entry for your own user.
- Download kubeconfig from "Get Kubeconfig", verify with e.g.
kubectl get nodesthat you no longer have permissions. - Go back to "RBAC", switch to "Group". Add a binding for a OIDC group that your user is part of (don't forget to add the
oidc:prefix; an example isoidc:kubermatic:development). Chosecluster-adminas role for simplicity. - Verify with the previously downloaded kubeconfig that your user is allowed to run
kubectl get nodesagain. - Click "Open Dashboard". Sign in with the same identity provider. Observe errors from the bell icon on the top right, and click "Nodes" from the left side menu to see that you cannot access nodes (or any other resource) from the dashboard.
Environment
- UI Version:
v2.24.0-beta.1(but also found on 2.23) - API Version:
v2.24.0-beta.1(but also found on 2.23) - Domain: -
- Others: -
Current workaround
Add user-based RBAC bindings for each user.
Affected user persona
Developers given access to user clusters
Business goal to be improved
Metric to be improved
As a note, I was debugging this briefly with a Kubermatic partner, and we saw the groups included in the OIDC token used by the Kubernetes Dashboard. It was therefore not clear to us why groups were seemingly ignored.
Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.
If this issue is safe to close now please do so with /close.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
/lifecycle rotten
/remove-lifecycle rotten
Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.
If this issue is safe to close now please do so with /close.
/lifecycle stale
/remove-lifecycle stale