Kubernetes Dashboard Setup

This topic describes how to set up the dashboard for the Kubernetes user interface.

The dashboard is a web-based Kubernetes user interface. You can use the dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster resources. You can use the dashboard to get an overview of the applications running on your cluster, as well as for creating or modifying individual Kubernetes resources (such as Deployments, Jobs, DaemonSets, etc). For example, you can scale a Deployment, initiate a rolling update, restart a POD, or deploy new applications using a deploy wizard.
  1. 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/aio/deploy/recommended.yaml
    • Create a new Directory for Dashboard and create a new yaml file for ServiceAccount and ClusterRoleBinding. Name the file as sa-dashboard.yaml
      apiVersion: v1
      kind: ServiceAccount
      metadata:
        name: dashboard-admin
        namespace: kube-system
      ---
      apiVersion: rbac.authorization.k8s.io/v1beta1
      kind: ClusterRoleBinding
      metadata:
        name: cluster-admin-rolebinding
      roleRef:
        apiGroup: rbac.authorization.k8s.io
        kind: ClusterRole
        name: cluster-admin
      subjects:
      - kind: ServiceAccount
        name: dashboard-admin
        namespace: kube-system
      
    • Execute the file on master node using below command:
      kubectl apply -f sa-dashboard.yaml
    • Now dashboard setup for the Kubernetes user interface is complete.
  2. To access the dashboard, you have to get the token. follow the below steps to get the token:
    • Get the service account, run command kubectl get sa -n kube-system, see the below image for reference.
    • Get the secret, run command kubectl describe sa dashboard-admin -n kube-system, see the below image for reference.
    • Get the token, kubectl describe secret dashboard-admin-token-v5g7h -n kube-system, see the below image for reference.
    • Run https://<master-node-ip>:30001/#/login on your browser, for example https://172.20.152.20:30001/#/login.
    • Use the same token extracted in the previous step for login, see the below image for reference.
    • See the below image for reference on the Kubernetes Deployment:
    • See the below image for reference on the Kubernetes services:
    • See the below image for reference on the Kubernetes PODs: