kubernetes-dashboard安装

    0

安装

  1. 应用 Dashboard YAML 文件
bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

注意:版本号(例如 v2.7.0)可能会有所不同,请检查 Kubernetes Dashboard GitHub 以获取最新版本。

  1. 获取访问令牌
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
  1. 获取令牌
bash
kubectl -n kubernetes-dashboard create token admin-user
bash
kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d

清除权限

bash
kubectl 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的

附录

评论区

共有评论 0

暂无评论