On kubernetes 1.8.4 I'm trying to give kubernetes users access to our dashboard.
When using the admin context to proxy, all the tokens work when logging into the dashboard. But my users don't have the admin context, only I do, so they use their own context to proxy. And in those situations, they get an error.
Steps:
- Create a service account for a user, put token in
~/.kube/config
- Give permissions to namespace A to that service account through rolebinding
- Switch to that user's context
- Do deployments, get pod overview, etc, verify it works. all fine so far
- Start
kubectl
proxy, still in that user's context - Open browser, go to http://localhost:8001/ui
See this in the browser:
{ "kind": "Status", "apiVersion": "v1", "metadata": {}, "status": "Failure", "message": " forbidden: User \"system:serviceaccount:default:<username>\" cannot get path \"/ui\"", "reason": "Forbidden", "details": {}, "code": 403 }
try http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
See this in the browser:
{ "kind": "Status", "apiVersion": "v1", "metadata": {}, "status": "Failure", "message": " services \"https:kubernetes-dashboard:\" is forbidden: User \"system:serviceaccount:default:<username>\" cannot get services/proxy in the namespace \"kube-system\"", "reason": "Forbidden", "details": { "name": "https:kubernetes-dashboard:", "kind": "services" }, "code": 403 }
Clearly a permission problem. I'm not sure which permission the user needs to have to enable them to access the dashboard though. I'm very hesitant to give them permissions into the kube-system namespace.
When I stop kubectl proxy and then switch to the admin context, start the proxy and retry the same url, I get the dashboard login page.
What do I need to do to get that same result when using the user's context?
/ui
is deprecated, see github.com/kubernetes/dashboard#getting-started .. use the full url instead: localhost:8001/api/v1/namespaces/kube-system/services/… – fishi0x01