Why is Kubernetes dashboard reporting Unauthorized?

1,776 views
Skip to first unread message

Mikael Pahmp

unread,
Feb 22, 2022, 3:42:02 AM2/22/22
to kubernetes-sig-ui
I've followed the steps at https://github.com/kubernetes/dashboard and https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md. When I try to login with token, the login page says: "Unauthorized (401): Invalid credentials provided".

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml

Created the ServiceAccount and ClusterRoleBinding as described.

$ kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}"
admin-user-token-lvxrd

$ kubectl -n kubernetes-dashboard get secret admin-user-token-lvxrd -o go-template="{{.data.token | base64decode}}"
eyJhbG ... NrutWc56Qz7-1dKG_

$ kubectl proxy

Browsed to: http://127.0.01:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
Entered token and got "Unauthorized (401): Invalid credentials provided"

$ kubectl -n kubernetes-dashboard logs kubernetes-dashboard-546cbc58cd-k65zv
...
2022/02/21 09:38:51 [2022-02-21T09:38:51Z] Incoming HTTP/2.0 GET /api/v1/csrftoken/login request from 127.0.0.1: { contents hidden }
2022/02/21 09:38:51 [2022-02-21T09:38:51Z] Outcoming response to 127.0.0.1 with 200 status code
2022/02/21 09:38:51 [2022-02-21T09:38:51Z] Incoming HTTP/2.0 POST /api/v1/login request from 127.0.0.1: { contents hidden }
2022/02/21 09:38:51 Non-critical error occurred during resource retrieval: the server has asked for the client to provide credentials
2022/02/21 09:38:51 [2022-02-21T09:38:51Z] Outcoming response to 127.0.0.1 with 200 status code


I also tried access through a NodePort and got the same error msg.
Have I missed a step? Is there some more logs about what is failing?

Grateful for any help.

/Mikael

Алексей

unread,
May 19, 2024, 3:47:25 PM5/19/24
to kubernetes-sig-ui
Reply all
Reply to author
Forward
0 new messages