kubernetes Dashboard是什么? Dashboard是kubernetes的Web GUI,可用于在kubernetes集群上部署容器化应用,应用排错,管理集群本身及其附加的资源等,它常被管理员用于集群及应用速览,创建或修改单个资源,(如Deployments,Jobs,DaemonSets的等)以及扩展Deployment,启动滚动更新,重启pod或使用向导部署一个新应用等。
部署dashboard
#当前部署dashboard版本:v2.0.0,注意检查dashboard版本与kubernetes版本兼容性 root@K8s-node2:~# docker pull kubernetesui/dashboard:v2.0.0-rc6 root@K8s-node2:~# docker pull kubernetesui/metrics-scraper:v1.0.3 root@K8s-master:/usr/local/src# vim dash_board-2.0.0-rc6.yml containers: - name: kubernetes-dashboard image: kubernetesui/dashboard:v2.0.0-rc6 imagePullPolicy: Always kind: Service apiVersion: v1 metadata: labels: k8s-app: dashboard-metrics-scraper name: dashboard-metrics-scraper namespace: kubernetes-dashboard kubectl apply -f dash_board-2.0.0-rc6.yml root@K8s-master:~# kubectl apply -f ad_min-user.yml
2.获取token
root@K8s-master:~# kubectl get secret -A | grep admin-user root@K8s-master:~# kubectl describe secret admin-user-token-f8dxt -n kubernetes-dashboard ard Name: admin-user-token-f8dxt Namespace: kubernetes-dashboard Labels: <none> Annotations: kubernetes.io/service-account.name: admin-user kubernetes.io/service-account.uid: 97addc8d-e189-4df0-bd3c-0a63227d51b3 Type: kubernetes.io/service-account-token Data ==== ca.crt: 1025 bytes namespace: 20 bytes token: eyJhbGciOiJSUzI1NiIsImtpZCI6IlA3RnBTTGVvbG44azA5M1B1bDVuMU81M0pBU0hhWGE2eG5ENFlBR3BNWVkifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLWY4ZHh0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5N2FkZGM4ZC1lMTg5LTRkZjAtYmQzYy0wYTYzMjI3ZDUxYjMiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4tdXNlciJ9.VPD5ywdQ72bniCo-etcf731gv_jjIux6PamWjYZANCStY6ayTRAla71G-g5D8gCDqiwdbQdMu7Sf8g64Y9z_E5vnhc7hklGC4A2qw2v6q8lnPnDG8RMkzLhA2NM-aRIy5df0bPRzhBas9YofaQHv_5TjOJEY4TWJ0XZkk78h_JM16X-ttS1-by_DnMGvnZGzu30wct-Twv0R-F-AuxETh3lGr2iL4uJZ41tnyefdrDvXB0un2OtgShlmu6HvqQXKFrw3umhUpasHo7OxtZX-f-2EFTz3xiQTt6QQY13YA2X48hqwtmCgREBiWJuV0aY7xXkI9qli-Ko6Ma4ra19IMA
3.验证nodeport root@K8s-master:/usr/local/src# kubectl get svc -A NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE default kubernetes ClusterIP 10.20.0.1 <none> 443/TCP 21h kube-system kube-dns ClusterIP 10.20.0.10 <none> 53/UDP,53/TCP,9153/TCP 21h kubernetes-dashboard dashboard-metrics-scraper ClusterIP 10.20.121.211 <none> 8000/TCP 4h48m kubernetes-dashboard kubernetes-dashboard NodePort 10.20.41.179 <none> 443:30002/TCP 4h48m
4.验证登录
5.登录成功
#!!!!到此 kubernetes之dashboard部署完成,希望对你有所帮助