天天看點

kubernetes實踐之二:Kubernetes可視WEB UI Dashboard搭建

Kubernetes可視WEBUI Dashboard搭建

支援浏覽器:火狐

一.Dashboard下載下傳位址

git clone https://github.com/kubernetes/kubernetes/

二.部署Dashboard需要檔案

[root@k8s_master ui]# ll

總用量 28

-rwxr-xr-x 1 root root  833 3月  20 19:13 dashboard-cert.sh

-rwxr-xr-x 1 root root  264 3月  20 19:13 dashboard-configmap.yaml

-rwxr-xr-x 1 root root 1819 3月  20 19:13 dashboard-controller.yaml

-rwxr-xr-x 1 root root 1353 3月  20 19:13 dashboard-rbac.yaml

-rwxr-xr-x 1 root root  551 3月  20 19:13 dashboard-secret.yaml

-rwxr-xr-x 1 root root  359 3月  20 19:13 dashboard-service.yaml

三.部署Dashboard

1. rbac部署(授權k8s可以通路apiserver)

              kubectl apply -f dashboard-rbac.yaml

2. secret部署

              kubectl apply -f dashboard-secret.yaml

3. configmap部署

              kubectl apply -f dashboard-configmap.yaml

4. controller部署

              需要修改鏡像位址:image: registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0

              kubectl apply -f dashboard-controller.yaml

              # kubectl get pods -n kube-system

NAME                                    READY   STATUS    RESTARTS   AGE

kubernetes-dashboard-785f8ff65c-r52pz       1/1     Running    0          2m31s

5. service部署(暴露端口30001)

              kubectl apply -f dashboard-service.yaml

              # kubectl get svc,pods -n kube-system

NAME                           TYPE       CLUSTER-IP   EXTERNAL-IP   PORT(S)         AGE

service/kubernetes-dashboard   NodePort   10.0.0.254   <none>        443:30001/TCP   2m3s

NAME                                        READY   STATUS    RESTARTS   AGE

pod/kubernetes-dashboard-785f8ff65c-r52pz   1/1     Running   0          3m56s

6. 建立賬号(k8s-admin)

              kubectl apply -f k8s-admin.yaml

              # kubectl get secret -n kube-system

NAME                               TYPE                                  DATA   AGE

dashboard-admin-token-xs5xf        kubernetes.io/service-account-token   3      43s

# kubectl describe secret dashboard-admin-token-xs5xf -n kube-system

token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4teHM1eGYiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZDQzNzQxNTEtNGIwNC0xMWU5LWEwMGMtMDgwMDI3M2VhZDE5Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.AL7VyiDHtUoseE6juK_m4OmUeUCGm8xZ497Ab0LY5QGEWa_PTGS044r81h_XKbvpKHgjdMTgPyh4jhBlBSf_LwQvrjhT537F4OjZTfbp1CRxRd9Np4RFOPkgDy7KeWpaYhGfickpwaOLl8PpSKxuHZEkeIVBiRElx-0G-xB4KV8fm34UUXOhx4SxcAIaVliiSSJemg-v2VDqnRNdnlSlyO9kJxV-MpExnIcu4WZsCJ-dHhlkUSukMC3_yV6Etz1RURUTtGiFvqnxF5rTJAT--e8UrxXSFZLrKYCBTxaH4QcwlqhlsMbmNa5PdEMhU3JdhjmDcnfoaYPzJ2T223Xatg

7. 登入dashboard

              https://192.168.1.155:30001/#!/login

kubernetes實踐之二:Kubernetes可視WEB UI Dashboard搭建

      令牌:上面生成的token

        

kubernetes實踐之二:Kubernetes可視WEB UI Dashboard搭建

 備注:官方包比較慢可以從百度雲上下載下傳,下載下傳位址:

 連結:https://pan.baidu.com/s/1K30ieuOJDiDFO_Ml4IlUiQ  密碼:d7pj