Unable to access Kubernete Dashboard

4/8/2020

I installed kubernete dashboard but i am unable to access the dashboard:

Error:

{ "kind": "Status", "apiVersion": "v1", "metadata": {

}, "status": "Failure", "message": "forbidden: User \"system:anonymous\" cannot get path \"/ui/\"", "reason": "Forbidden", "details": {

}, "code": 403 }

I ran : "kubectl proxy" to proxy the API server to localhost but it didn't return anything yet. I see the proxy is serving but still getting the above error.

-- Oluyomi Sunmonu
kubernetes

1 Answer

4/8/2020

From your error it seems like the RBAC policies are miss configured or broken.

If you execute:

kubectl create clusterrolebinding cluster-system-anonymous --clusterrole=cluster-admin --user=system:anonymous

it will set a clusterrole as cluster-admin which will give you the required access, but you have to make sure you are using correct address to access Dashboard.

$ kubectl proxy is not supposed to return anything, as it's just starting a proxy. For it to work you have to have it running in the background to use localhost.

If you used this dashboard.yaml file, your dashboard will be installed in kubernetes-dashboard namespace. Once you run kubectl proxy, dashboard can be accessed using following address:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

If you used a different yaml you can check where dashboard is running by using $ kubectl get pods -A |grep kubernetes-dashboard, first row will tell you in which namespace it's deployed. Based on that you need to change the address you are trying to access the dashboard.

You can also try removing the dashboard deployment and applying it again. Also please read docs about Dashboard.

-- Crou
Source: StackOverflow