安装
- 应用 Dashboard YAML 文件
bashkubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
注意:版本号(例如 v2.7.0)可能会有所不同,请检查 Kubernetes Dashboard GitHub 以获取最新版本。
- 获取访问令牌
yaml#创建服务帐户 apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard --- #创建 ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard
- 获取令牌
bashkubectl -n kubernetes-dashboard create token admin-user
bashkubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d
清除权限
bashkubectl create serviceaccount dashboard-admin -n kubernetes-dashboard kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin --- kubectl -n kubernetes-dashboard delete serviceaccount admin-user kubectl -n kubernetes-dashboard delete clusterrolebinding admin-user
F&Q
https会报错 bad certificate
,需要把yaml下载下来 把端口改成http的