OIDC login #8980
Replies: 4 comments 4 replies
-
I'm having trouble with this too, with oauth2-proxy and kubernetes-dashboard 7.x. Once I log in to my OIDC provider and it redirects me back to kubernetes-dashboard, it shows the default login screen asking for a bearer token in an HTML form. I can see an authorization header that contains a bearer token, as well as an x-auth-request-email header containing my email address, in the response headers. What do I need to do to get OIDC working with the dashboard? |
Beta Was this translation helpful? Give feedback.
-
I dont have a ready example available. Do I then enable kong or not (still dont really get why it is needed) and with service I should use as the upstream? |
Beta Was this translation helpful? Give feedback.
-
Has anyone found a solution for this? I have oauth2-proxy working with the kubernetes dashboard with Kong enabled and ingress-nginx however I can't seem to get this to work when Traefik is the ingress controller. |
Beta Was this translation helpful? Give feedback.
-
I think I found a working solution, if it helps anyone. I was also struggling with the fact that my authentication attempts were always rejected, but my "regular" admin token worked. I believe the final culprit in my case (don't ask me why) was that I needed to point oauth2-proxy at the kong gateway, not at the individual services behind it. I'll share my full solution though, in case you have issues elsewhere: oauth2_proxy.cfg email_domains = [ "*" ]
reverse_proxy = true
ssl_upstream_insecure_skip_verify = true
upstreams = ["https://kubernetes-dashboard-kong-proxy.kubernetes-dashboard.svc.cluster.local:443"]
pass_authorization_header = true
provider = "oidc"
provider_display_name = "Authentik"
oidc_issuer_url = "https://auth.example.com/application/o/kubernetes-dashboard/" Note here that I set the Cluster Role Binding for user apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: User
name: https://auth.example.com/application/o/kubernetes-dashboard/#<sub>
apiGroup: rbac.authorization.k8s.io Note that you need the full URL for the user here. I haven't done group based RBAC yet. The HTTPRoute (Gateway API using Traefik) apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: dashboard
namespace: kubernetes-dashboard
spec:
parentRefs:
- name: traefik-gateway
namespace: traefik
hostnames:
- k8s-dashboard.example.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: oauth2-proxy
port: 80 Kube API server args
Note that the issuer URL must match the If you are troubleshooting this and can't get it to work, I suggest doing it piece by piece:
Through all of this, using curl 'https://k8s-dashboard.example/api/v1/login' -H 'content-type: application/json; charset=utf-8' -H "X-CSRF-TOKEN: $(curl 'https://k8s-dashboard.example.com/api/v1/csrftoken/login' | jq .token -r)" -d '{"token": "<JWT TOKEN>"}' You can point it at localhost, too, just make sure replace both URLs and insert the token you want to test. Look at the error message, if it says something about CSRF fix the header first. |
Beta Was this translation helpful? Give feedback.
-
HI
For v6 of kubernetes dashboard, we have a oauth2-proxy in front of the applicaties.
The proxy makes sure the user has logged in en passes the bearer token to the request to kubernetes dashboard application.
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/README.md#authorization-header
We have tried to upgrade to v7, but many things have changed.
No matter what we do, we only get the default login screen.
we have tried:
with kong disabled.
point oauth2-proxy upstream to kubernetes-dashboard-web service.
with kong enabled:
point oauth2-proxy upgrade to kubernetes-dashboard-web service.
point oauth2-proxy upgrade to kong-proxy service.
The login flow still work, but the upstream only show the k8s login.
I did now see
Auth container
Authentication logic is now handled by the new dashboard auth container. Currently, it only exposes /login endpoint. We will also add support for OIDC with OAuth flow and /me endpoint in the future.
Added csrf-key argument - Base64 encoded random 256 bytes key. Can be loaded from CSRF_KEY environment variable.
Does this mean oidc is not yet supported for dashboard v7?
Beta Was this translation helpful? Give feedback.
All reactions