Saturday, January 11, 2020

Kubernetes:: Deploy the Web UI (Dashboard)

Recently I started exploring Kubernetes and tried to deploy the dashboard UI. Here is the list of steps followed to setup dashboard for my kubernetes cluster.

1. Refer to to get latest YAML file to setup dashboard. Run following command on your master node to deploy latest dashboard.
kubectl apply -f

2. Run below command to view the deployed dashboard details

kubectl get services --all-namespaces -o wide
kubectl get deployments --all-namespaces -o wide
kubectl get pods --all-namespaces -o wide

kubectl -n kubernetes-dashboard describe pod kubernetes-dashboard
kubectl -n kubernetes-dashboard describe pod dashboard-metrics-scraper

3. Create a dashboard-admin-service-account.yaml file with below content.

apiVersion: v1
kind: ServiceAccount
  name: dashboard-user
  namespace: kubernetes-dashboard
kind: ClusterRoleBinding
  name: dashboard-user
  kind: ClusterRole
  name: cluster-admin
- kind: ServiceAccount
  name: dashboard-user
  namespace: kubernetes-dashboard

4. Run the dashboard-admin-service-account.yaml file to perform following actions.

  • Create Service Account with name dashboard-user in namespace kubernetes-dashboard first.
  • Create ClusterRoleBinding for ServiceAccount

kubectl apply -f dashboard-admin-service-account.yaml

5. Run below command to get token for the dashboard-user user. This is required to login to dashboard.

kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep dashboard-user | awk '{print $1}') | grep token:

6. Run below command to access Dashboard from your local workstation you must create a secure channel to your Kubernetes cluster

kubectl proxy

7. Setup SSH tunneling via Putty. This step is not required, if you are accessing browser on same host.

8. Open browser and access below URL.


9. Select Token and copy the token output from step#6 into Enter token field on login screen.. Click on Sign in button.

10. Dashboard will be displayed.

No comments:

Post a Comment

Provide your thoughts !