Kubernetes : Enable Dashboard2024/11/06 |
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: Wed Nov 6 11:11:15 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:8443[root@dlp ~]# kubectl get pods -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE kubernetes-dashboard-api-74d899fc87-ltcpz 1/1 Running 0 28s kubernetes-dashboard-auth-57898dc475-8q4zs 1/1 Running 0 28s kubernetes-dashboard-kong-75bb76dd5f-9xbnx 1/1 Running 0 28s kubernetes-dashboard-metrics-scraper-5f645f778c-wb6g8 1/1 Running 0 28s kubernetes-dashboard-web-5bf7668478-9wmrd 1/1 Running 0 28s |
[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 service/kubernetes-dashboard --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 |