创建dashboard-admin SA并绑定ClusterRole:cluster-admin

apiVersion: v1
kind: ServiceAccount
metadata:
  name: dashboard-admin
  namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: dashboard-admin
subjects:
  - kind: ServiceAccount
    name: dashboard-admin
    namespace: kube-system
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io

获取secret token

kubectl get secret dashboard-admin-token-cptlv -n kube-system -o jsonpath={.data.token}  |base64 -d

访问集群

curl -k -H 'Authorization: Bearer 你的token' https://你的APIserver地址
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐