Dashboard是基于Web的Kubernetes用户界面,Kubernetes Dashboard 可以部署容器化的应用、监控应用的状态、执行故障排查任务以及管理 Kubernetes 各种资源。
DashBoard 部署参看文档:部署和访问 Kubernetes 仪表板(Dashboard) | Kubernetes DashBoard的yaml文件项目:https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml
1、安装Kubernetes DashBoard
#下载DashBoard的yaml文件(在名称kubernetes-dashboard的Service类型新增:type: NodePort nodePort: 30000)
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml
#查看是否启动成功
kubectl get deployment,pod,service -n kubernetes-dashboard
2、获取token
#创建账号
kubectl create serviceaccount dashboard-admin -n kube-system
#授权
kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
#获取账号token
kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret | awk '/dashboard-admin/{print $1}')
或者
kubectl get secrets -n kube-system | grep dashboard-admin
kubectl describe secrets dashboard-admin-token-fgq2n -n kube-system#token值详细信息如下:
Name: dashboard-admin-token-fgq2n
Namespace: kube-system
Labels: Type: kubernetes.io/service-account-tokenData
====
ca.crt: 1099 bytes
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6Ii11YzhuNzMwYmVQVUhtdXNxT2pKc2hOWWlWOE9qX2tJdkc0S1JUeTZreDAifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tZmdxMm4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiYWIxOGI2OWUtODc3Mi00NDk5LWFlMmUtZmZhZmE2ODJlNGVlIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.iV0IK1lxpnyQmmWPjNRiCrwLUpmBLFTNd6VLxq1ShPGiuWMRwaJN5Ko45ZdmtRidynFfvQv7mo5FTLQjVhnM0W5DR-QzMxKIzVS9HdOFNsk3ZcnSd5taCVprpYLC3bMDLIKktjy034kBd3DB0NsmeKbV7RwWZmadxkZg2ErSVsawZIOS5wS9qEVWZQwwZCghFZYFFbHcJQIMP_jtY7h7YnoB1FwekeYj0zhfDVOL0h7xdrfNImMF-5yG6uGtip2tYJtz1eAZJ-ypnPrZ2Xa-Z8ji3CsA-9-CdOvQmL9n5mvW9XqPvmRCR27HBZ3LWdeEAqUFi44xQ9PIoIjsmFSWjw
3、访问Kubernetes DashBoard
https://192.168.80.220:30000/(注意:协议是https协议)