k8s使用token连接集群
创建dashboard-admin SA并绑定ClusterRole:cluster-adminapiVersion: v1kind: ServiceAccountmetadata:name: dashboard-adminnamespace: kube-system---kind: ClusterRoleBindingapiVersion: rbac.authorization.k8s.io/v
·
创建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地址
更多推荐
已为社区贡献14条内容
所有评论(0)