Kubernetes : Enable Dashboard2025/04/25 |
Enable Dashboard to manage Kubernetes Cluster on Web UI. This example is based on the environment like follows. -----------+---------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.51 eth0|10.0.0.52 +----------+-----------+ +-----------+----------+ +-----------+----------+ | [ dlp.srv.world ] | | [ node01.srv.world ] | | [ node02.srv.world ] | | Control Plane | | Worker Node | | Worker Node | +----------------------+ +----------------------+ +----------------------+ |
[1] | Enable Dashboard on Control Plane Node. |
[root@dlp ~]#
[root@dlp ~]# dnf -y install helm helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ "kubernetes-dashboard" has been added to your repositories [root@dlp ~]# helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard NAME: kubernetes-dashboard LAST DEPLOYED: Fri Apr 25 19:00:36 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[root@dlp ~]# kubectl get pods -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE kubernetes-dashboard-api-679587874d-lsb9n 1/1 Running 0 29s kubernetes-dashboard-auth-5568b645cf-cvlqq 1/1 Running 0 29s kubernetes-dashboard-kong-694bd68766-m5ckl 1/1 Running 0 29s kubernetes-dashboard-metrics-scraper-55658857fc-985k4 1/1 Running 0 29s kubernetes-dashboard-web-6c54c95d7b-qdbqb 1/1 Running 0 29s |
[2] | Add an account for Dashboard management. |
[root@dlp ~]#
kubectl create serviceaccount -n kubernetes-dashboard admin-user serviceaccount/admin-user created
[root@dlp ~]#
vi rbac.yml # create new apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard
[root@dlp ~]#
kubectl apply -f rbac.yml clusterrolebinding.rbac.authorization.k8s.io/admin-user created # get security token of the account above [root@dlp ~]# kubectl -n kubernetes-dashboard create token admin-user eyJhbGciOiJSUzI1Ni..... # set port-forwarding to access to dashboard [root@dlp ~]# 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 |
[3] |
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. |
![]() |
[4] | After authentication successfully passed, Kubernetes Cluster Dashboard is displayed. |
![]() |
![]() |
Sponsored Link |
|