How to access Kubernetes Dashboard

Deploying the Dashboard UI

The Dashboard UI is not deployed by default. To deploy it, run the following command:

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

Command line proxy

You can access Dashboard using the kubectl command-line tool by running the following command:

kubectl proxy

Kubectl will make Dashboard available at http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/.

Kubernetes Dashboard Authentication

Above link asks for authentication. Use below commands to get token

Create the dashboard service account

kubectl create serviceaccount dashboard-admin-sa

This will create a service account named dashboard-admin-sa in the default namespace

Get Naresh Kancharla’s stories in your inbox

Join Medium for free to get updates from this writer.

Remember me for faster sign in

 

Next bind the dashboard-admin-service-account service account to the cluster-admin role

kubectl create clusterrolebinding dashboard-admin-sa 
--clusterrole=cluster-admin --serviceaccount=default:dashboard-admin-sa

When we created the dashboard-admin-sa service account Kubernetes also created a secret for it.

List secrets using:

kubectl get secrets
Press enter or click to view image in full size

Get Token

Use kubectl describe to get the access token:

kubectl describe secret dashboard-admin-sa-token-t5g67
Press enter or click to view image in full size

Copy the token and enter it into the token field on the Kubernetes dashboard login page.

posted @ 2026-07-03 15:22  Oops!#  阅读(3)  评论(0)    收藏  举报