分布式云原生平台支持导入 Token 方式注册现有集群,本文为您介绍如何获取 Token。
# 创建 serviceAccount apiVersion: v1 kind: ServiceAccount metadata: name: dcp-token namespace: kube-system --- # 为 serviceAccount 绑定集群角色 apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: dcp-token roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: dcp-token namespace: kube-system --- # 生成 token 信息 apiVersion: v1 kind: Secret metadata: name: dcp-token namespace: kube-system annotations: kubernetes.io/service-account.name: "dcp-token" type: kubernetes.io/service-account-token
kubectl -n kube-system describe secret dcp-token
获取已经生成的 Token 信息。