Kubernetes : Enable Dashboard2025/01/24 |
Enable Dashboard to manage Kubernetes Cluster on Web UI. In this example, a Kubernetes cluster is configured using four nodes as follows. +----------------------+ +----------------------+ | [ ctrl.srv.world ] | | [ dlp.srv.world ] | | Manager Node | | Control Plane | +-----------+----------+ +-----------+----------+ eth0|10.0.0.25 eth0|10.0.0.30 | | ------------+--------------------------+----------- | | eth0|10.0.0.51 eth0|10.0.0.52 +-----------+----------+ +-----------+----------+ | [ node01.srv.world ] | | [ node02.srv.world ] | | Worker Node#1 | | Worker Node#2 | +----------------------+ +----------------------+ |
[1] | |
[2] | Enable Dashboard. |
[centos@ctrl ~]$
[centos@ctrl ~]$ helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ "kubernetes-dashboard" has been added to your repositories helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard NAME: kubernetes-dashboard LAST DEPLOYED: Thu Jul 3 11:09:07 2025 NAMESPACE: kubernetes-dashboard STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: ************************************************************************************************* *** PLEASE BE PATIENT: Kubernetes Dashboard may need a few minutes to get up and become ready *** ************************************************************************************************* Congratulations! You have just installed Kubernetes Dashboard in your cluster. To access Dashboard run: kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 NOTE: In case port-forward command does not work, make sure that kong service name is correct. Check the services in Kubernetes Dashboard namespace using: kubectl -n kubernetes-dashboard get svc Dashboard will be available at: https://localhost:8443[centos@ctrl ~]$ kubectl get pods -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE kubernetes-dashboard-api-7fd87c4b8f-6dvgh 1/1 Running 0 24s kubernetes-dashboard-auth-6799f98648-9w5zq 1/1 Running 0 24s kubernetes-dashboard-kong-79867c9c48-gz5rn 1/1 Running 0 24s kubernetes-dashboard-metrics-scraper-547874fcf-xwp7n 1/1 Running 0 24s kubernetes-dashboard-web-7796b9fbbb-kqg9n 1/1 Running 0 24s |
[3] | Add a service account for the dashboard and configure it to have access to the dashboard. |
[centos@ctrl ~]$
kubectl create serviceaccount -n kubernetes-dashboard dashboard-admin serviceaccount/dashboard-admin created
[centos@ctrl ~]$
vi rbac.yml # create new apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: dashboard-admin roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: dashboard-admin namespace: kubernetes-dashboard
[centos@ctrl ~]$
kubectl apply -f rbac.yml clusterrolebinding.rbac.authorization.k8s.io/dashboard-admin created # get security token of the account above [centos@ctrl ~]$ kubectl -n kubernetes-dashboard create token dashboard-admin eyJhbGciOiJSUzI1NiIsI..... # set port-forwarding to access to dashboard [centos@ctrl ~]$ kubectl port-forward -n kubernetes-dashboard svc/kubernetes-dashboard-kong-proxy --address 0.0.0.0 8443:443 Forwarding from 0.0.0.0:8443 -> 8443 |
[4] |
Access to the URL below on a client computer in your local network.
⇒ https://(Control Plane Node Hostname or IP address):(setting port)/
After displaying following form, Copy and paste the security token you got on [2] to [Enter token] section and Click [Sing In] button.
|
![]() |
[5] | After authentication successfully passed, Kubernetes Cluster Dashboard is displayed. |
![]() |
![]() |
![]() |
![]() |
Sponsored Link |
|