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