dashboard: Dashboard not working after re-deployment in GCE
Environment
Dashboard version: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.7.0
Kubernetes version: 1.7.4 og pool and master cluster version 1.7.6
Running on GCE
Steps to reproduce
Have the defualt GCE cluster running with 1.7.5. Verify the dashboard works on http://localhost:8001/ui Then try to deploy the recomended version: https://github.com/kubernetes/dashboard/blob/master/src/deploy/recommended/kubernetes-dashboard.yaml
Observed result
The recommended version fails with error:
secret "kubernetes-dashboard-certs" created
serviceaccount "kubernetes-dashboard" created
rolebinding "kubernetes-dashboard-minimal" created
deployment "kubernetes-dashboard" configured
service "kubernetes-dashboard" configured
Error from server (Forbidden): error when creating "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml": roles.rbac.authorization.k8s.io "kubernetes-dashboard-minimal" is forbidden: attempt to grant extra privileges: [PolicyRule{Resources:["secrets"], APIGroups:[""], Verbs:["create"]} PolicyRule{Resources:["secrets"], APIGroups:[""], Verbs:["watch"]} PolicyRule{Resources:["secrets"], ResourceNames:["kubernetes-dashboard-key-holder"], APIGroups:[""], Verbs:["get"]} PolicyRule{Resources:["secrets"], ResourceNames:["kubernetes-dashboard-certs"], APIGroups:[""], Verbs:["get"]} PolicyRule{Resources:["secrets"], ResourceNames:["kubernetes-dashboard-key-holder"], APIGroups:[""], Verbs:["update"]} PolicyRule{Resources:["secrets"], ResourceNames:["kubernetes-dashboard-certs"], APIGroups:[""], Verbs:["update"]} PolicyRule{Resources:["secrets"], ResourceNames:["kubernetes-dashboard-key-holder"], APIGroups:[""], Verbs:["delete"]} PolicyRule{Resources:["secrets"], ResourceNames:["kubernetes-dashboard-certs"], APIGroups:[""], Verbs:["delete"]} PolicyRule{Resources:["services"], ResourceNames:["heapster"], APIGroups:[""], Verbs:["proxy"]}] user=&{snorre.edwin@bekk.no [system:authenticated] map[]} ownerrules=[PolicyRule{Resources:["selfsubjectaccessreviews"], APIGroups:["authorization.k8s.io"], Verbs:["create"]} PolicyRule{NonResourceURLs:["/api" "/api/*" "/apis" "/apis/*" "/healthz" "/swaggerapi" "/swaggerapi/*" "/version"], Verbs:["get"]}] ruleResolutionErrors=[]
Expected result
To see the dashboard
Comments
A collegue of mine deployed this kubernetes-dashboard, after a mistake and now I cant get it back. Iv tried the alternative version and other things, but I cant seem to get it working again
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (8 by maintainers)
If you enabled RBAC, just type
and
@floreks, and everyone, I think I managed to fix the issue (at least for my setup). I got some help from @liggitt on the kubernetes slack, who was super awesome.
THESE ARE ALL THE STEPS I USED:
First I determined that I did not have the correct roles installed, which should be setup by the api-server, by default:
I needed to run the
api-serverwith the flag--authorization-mode=RBAC,AllowAlwayswhich I learned will enableRBACby default but will drop back toAllowAlwaysif auth fails.This is verified in the
api-serverlogs which will show a bunch of lines like:This is not a production recommended solution, so I needed to bind it to a role. However, it worked:
Next I discovered that the only role that is enabled by default for SuperUser access is the
system:mastersgroup, not a particular username. So my Admin cert creation process needed to includeO=system:mastersas the Org name:I changed my
api-serverflag to only--authorization-mode=RBACand restarted services. Using my new cert in mykubeconfig:I was able to successfully query:
Lastly, with the correct permissions and roles bound, I could create Dashboard with correct permissions, using only RBAC:
This is what worked for me, I hope anyone who finds this finds it helpful. ๐
Make sure to grant yourself in GC IAM the Container Engine Admin/Cluster Admin rights. Hope this helps, but further support for that is not part of the kubernetes/dashboard project.
This looks to me like privilege escalation protection. Are you sure that with the account you want to create apply the
dashboard.yamlyou have the necessary right to create secrets etc.? You canโt grant more permissions than your own account has in kubernetes.