Couldn't access Kubernetes dashboard on Google Cloud

后端 未结 4 2033
無奈伤痛
無奈伤痛 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:51

    If you choose to deploy k8s on Google Compute Engine it is still possible to access the dashboard. True if the instructions at kubernetes.io/docs/setup/ are followed, you will receive 403's as described.

    Firstly you need to deploy a 'dashboard deployment' run this command;

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

    Once created (in the kube-system namespace btw), create a clusterrolebinding with this command;

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

    Run the following to get a token; kubectl config view | grep token

    Next run a kubectl proxy with command; kubectl proxy

    You will now be able to access the dashboard at uri below. You will need to pass the token from above to authenticate, and that's it...

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

提交回复
热议问题