Dashboard部署

官网

https://kubernetes.io/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard/
image

一、下载资源清单文件

  • 上述官网提供的地址无法访问,所以无法直接部署
#官方给的地址
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.6.1/aio/deploy/recommended.yaml

二、安装

kubectl apply -f recommend.yaml
image

三、访问

image

四、创建dashboard服务账号

官网介绍:https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md

image

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard

---
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

获取token

image

kubectl create token admin-user -n kubernetes-dashboard

image

清理操作

  • 删除ServiceAccount
    kubectl delete serviceaccount admin-user -n kubernetes-dashboard

  • 删除ClusterRoleBinding
    kubectl delete clusterrolebinding admin-user -n kubernetes-dashboard

posted @ 2022-11-13 18:28  弩哥++  阅读(54)  评论(0编辑  收藏  举报