Couldn't access Kubernetes dashboard on Google Cloud

后端 未结 4 2029
無奈伤痛
無奈伤痛 2021-02-10 21:19

I am following the instructions as given here.

I used the following command to get a running cluster, in gcloud console I typed: curl -sS https://get.k8s.io | bash

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-10 21:39

    Is there a reason why you did not use GKE (Google Kubernetes Engine) which provides the dashboard add-on installed out of the box?

    In your case, simply:

    • the kubernetes-dashboard addon might not be installed (but logs say so, so I think this is not the problem)
    • network configuration that makes kubectl proxy work might not be there
    • the curl .. | sh script you used probably did not configure the authentication properly.

    I recommend using GKE as this works out of the box. You can find documentation here: https://cloud.google.com/kubernetes-engine/docs/oss-ui


    If you still want to use GCE, I recommend running kubectl proxy on your workstation (not your kubernetes nodes) and visiting http://127.0.0.1:8001/ui on your browser to see if it works.

    If you get an error about not having enough permissions, you might be using a Kubernetes version new enough that enforces RBAC policies on pods like dashboard which access the API. You can grant those permissions by running:

    kubectl create clusterrolebinding add-on-cluster-admin  \
      --clusterrole=cluster-admin  \
      --serviceaccount=kube-system:default
    

    I also recommend trying out GKE UI in Google Cloud Console: https://console.cloud.google.com/kubernetes

提交回复
热议问题