Kubernetes : Enable Dashboard2024/06/07 |
Enable Dashboard to manage Kubernetes Cluster on Web UI. This example is based on the cluster environment like 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] | Install Dashboard on Manager Node. |
root@ctrl:~# helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ "kubernetes-dashboard" has been added to your repositories root@ctrl:~# helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard NAME: kubernetes-dashboard LAST DEPLOYED: Fri Jun 7 00:34:22 2024 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:8443root@ctrl:~# kubectl get pods -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE kubernetes-dashboard-api-5f5bf66548-vzt62 1/1 Running 0 39s kubernetes-dashboard-auth-55bc6674fd-ckkrq 1/1 Running 0 39s kubernetes-dashboard-kong-7696bb8c88-hg2p6 1/1 Running 0 39s kubernetes-dashboard-metrics-scraper-5485b64c47-kvtm7 1/1 Running 0 39s kubernetes-dashboard-web-84f8d6fff4-h9dtf 1/1 Running 0 39s |
[3] | Add an account for Dashboard management. |
root@ctrl:~#
vi rbac.yml # create new file 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@ctrl:~#
kubectl apply -f rbac.yml clusterrolebinding.rbac.authorization.k8s.io/admin-user created # get security token of the account above root@ctrl:~# kubectl -n kubernetes-dashboard create token admin-user eyJhbGciOiJSUz..... # to access to dashboard, set port-forwarding root@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://(Manager 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 |