A better way to manage Kubernetes resources.
What is the Kubernetes Dashboard?
Kubernetes Dashboard is a web-based user interface to visualize the Kubernetes cluster. It shows you the details of the Kubernetes cluster, which includes the nodes in the cluster, namespaces, volumes, cluster roles, job details, and much more. You can deploy a containerized application through the Kubernetes dashboard with just a few clicks and manage all the cluster resources with ease.
Prerequisite
You must have a running Kubernetes cluster before setting up a Kubernetes dashboard. Read this article to learn how to set up Kubernetes.
Deploy Kubernetes Dashboard
Run below kubectl
command on the master node to deploy the Kubernetes dashboard.
geekflare@kubernetes-master:~$ sudo kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
You can see dashboard pods are in running state now.
geekflare@kubernetes-master:~$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-6955765f44-hwxdq 1/1 Running 0 6m35s
kube-system coredns-6955765f44-z2tdg 1/1 Running 0 6m35s
kube-system etcd-kubernetes-master 1/1 Running 0 6m45s
kube-system kube-apiserver-kubernetes-master 1/1 Running 0 6m45s
kube-system kube-controller-manager-kubernetes-master 1/1 Running 0 6m45s
kube-system kube-proxy-4b5jz 1/1 Running 0 6m35s
kube-system kube-proxy-v26wn 1/1 Running 0 26s
kube-system kube-scheduler-kubernetes-master 1/1 Running 0 6m45s
kubernetes-dashboard dashboard-metrics-scraper-76585494d8-czrtf 1/1 Running 0 2m37s
kubernetes-dashboard kubernetes-dashboard-5996555fd8-5mhxm 1/1 Running 0 2m37s
Access Kubernetes Dashboard
Run the below command to access Kubernetes dashboard at 192.168.0.107:8001
(change this to your IP)
geekflare@kubernetes-master:~$ kubectl proxy --port=8001 --address='192.168.0.107' --accept-hosts="^*$"
Starting to serve on 192.168.0.107:8001
Open the browser and go to the link below to login to the Kubernetes dashboard.

These are the two ways to login to Kubernetes Dashboard.
- Token
- kubeconfig
Generate Token to log in
- In the default namespace, create a service account.
geekflare@kubernetes-master:~$ kubectl create serviceaccount geekflare -n default
serviceaccount/geekflare created
- Create cluster binding rules for the newly created service account.
geekflare@kubernetes-master:~$ kubectl create clusterrolebinding geekflare-admin -n default --clusterrole=cluster-admin --serviceaccount=default:geekflare
clusterrolebinding.rbac.authorization.k8s.io/geekflare-admin created
- Run the
kubectl
command below to generate the token
geekflare@kubernetes-master:~$ kubectl get secret $(kubectl get serviceaccount geekflare -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode
eyJhbGciOiJSUzI1NiIsImtpZCI6ImZxeUhfd0ROdE1qOWxqcFhQODR2NDVFaTJSQU85VHhyUnRneVRCZzBJVUkifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImRhc2hib2FyZC10b2tlbi02ajhyNSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJkYXNoYm9hcmQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJhNzBiNzZmZC1iMzI1LTRiNTUtYTc5YS0wZDRmNjAwNTI4MTAiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpkYXNoYm9hcmQifQ.KtOGDMp_llQ1_V5OpJGsXzPlDkKw2y4y9TowlTH7WnU84LZHZLPar65cVOh20kPkRGJZmKkmkjuXKc1VcmBJQQCLSJgXb3G-7-OSC8LvC-3ROA0cjsGqDuFtXvA4bjlRJ1wGmAmaCgO8oeXVHqciEjw9wcH5tPRKGlvXAESmDlxH_rVu_TJpqSAb2pp3V0_fpD7VxU34mSfLEoMImixHbCILt0YGS9VyEJUgzcOdfj2ZvECOEbD_Y5LPLcTe0fkBJvwIiIgwxCttFRXktdExo7Z17WlekZJLcCBzRWTfrWte8Ugf6vfpN7IfJVWqQLpDZ9XtgHavpXXeJbp2FljIFw
You can use the generated token (as shown above) to login to the dashboard.
kubeconfig
The other way to login is by using the Kubernetes configuration file.
- Select the option Kubeconfig and click on “Choose Kubeconfig file.”

- Use the admin.conf, file present at
$HOME/.kube/config/
path and login to the dashboard successfully

Dashboard Interface
This is how the dashboard interface will look like.

You see the details of the Nodes, Persistent Volumes, Namespaces, Cluster Roles running in the Kubernetes cluster.


Using the dashboard, you can write YAML code in the editor to add new resources to the cluster.

Once the cluster has multiple jobs running, you will get more visualization options. It will tell you which jobs failed or passed. If there is an issue with the cluster, you can see it in the dashboard easily.
-
Avi is a tech enthusiast with expertise in trending technologies such as DevOps, Cloud Computing, Big Data and many more. He is passionate about learning cutting-edge technologies and sharing his knowledge with others through… read more