部署面板
1 2 3 4 5 6 7
| GITHUB_URL=https://github.com/kubernetes/dashboard/releases
VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||')
wget https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml
kubectl create -f recommended.yaml
|
仪表盘 RBAC 配置
dashboard.admin-user.yml
:
1 2 3 4 5
| apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard
|
dashboard.admin-user-role.yml
1 2 3 4 5 6 7 8 9 10 11 12
| 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
|
部署admin-user
配置:
1
| kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml
|
获得 Bearer Token
1
| kubectl -n kubernetes-dashboard create token admin-user
|
参考文章
英文:https://docs.k3s.io/installation/kube-dashboard
中文:https://docs.rancher.cn/docs/k3s/installation/kube-dashboard/_index