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] |
Disable Firewalld if it is running on all nodes, except for the Manager node. |
[2] | |
[3] | Enable Dashboard. |
[cent@ctrl ~]$
[cent@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 Jan 23 16:06:49 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[cent@ctrl ~]$ kubectl get pods -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE kubernetes-dashboard-api-7d7d4bd7f9-dhhj6 1/1 Running 0 46s kubernetes-dashboard-auth-7d7668b79c-4smlb 1/1 Running 0 46s kubernetes-dashboard-kong-678c76c548-5vzdm 1/1 Running 0 46s kubernetes-dashboard-metrics-scraper-879878d85-w9nb6 1/1 Running 0 46s kubernetes-dashboard-web-678b46855b-ncx7j 1/1 Running 0 46s |
[4] | Add a service account for the dashboard and configure it to have access to the dashboard. |
[cent@ctrl ~]$
kubectl create serviceaccount -n kubernetes-dashboard dashboard-admin serviceaccount/dashboard-admin created
[cent@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
[cent@ctrl ~]$
kubectl apply -f rbac.yml clusterrolebinding.rbac.authorization.k8s.io/dashboard-admin created # get security token of the account above [cent@ctrl ~]$ kubectl -n kubernetes-dashboard create token dashboard-admin eyJhbGciOiJSUzI1NiIsI..... # set port-forwarding to access to dashboard [cent@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 |
[5] |
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.
|
![]() |
[6] | After authentication successfully passed, Kubernetes Cluster Dashboard is displayed. |
![]() |
![]() |
Sponsored Link |
|