创建dashboard-admin.yaml,内容为以下
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: kubernetes-dashboard namespace: kube-system roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: kubernetes-dashboard namespace: kube-system应用资源文件dashboard-admin.yaml
kubectl apply -f dashboard-admin.yaml授权成功,可以通过dashboard查看到资源