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
令牌:上面生成的token
备注:官方包比较慢可以从百度云上下载,下载地址:
链接:https://pan.baidu.com/s/1K30ieuOJDiDFO_Ml4IlUiQ 密码:d7pj
原文地址:https://www.cnblogs.com/521football/p/10567240.html