集群导入
Bearer Token
获取 apiserver 地址
cat ~/.kube/config | grep server: | awk ‘{print $2}’
- 注意: 如果 server IP 为 127.0.0.1,需要将 IP 替换为集群 master 节点 IP
获取 Token
默认
KubeOperator 部署的 Kubernetes 集群,可在集群任意节点上执行如下命令
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep ko-admin | awk '{print $1}') | grep token: | awk '{print $2}'
Kubectl 方式部署的 KubePi 服务,在集群任意节点上执行如下命令
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep kubepi-user | awk '{print $1}') | grep token: | awk '{print $2}'
自定义
创建 Service Account
cat <<EOF > kubepi-serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubepi-user
namespace: kube-system
EOF
kubectl create -f ./kubepi-serviceaccount.yaml
创建 ClusterRoleBinding
cat <<EOF > kubepi-clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubepi-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubepi-user
namespace: kube-system
EOF
kubectl create -f ./kubepi-clusterrolebinding.yaml
获取 Token
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep kubepi-user | awk '{print $1}') | grep token: | awk '{print $2}'
kubeconfig 文件
将任意集群节点 kubeconfig 文件拷贝到本机后导入(默认路径为: ~/.kube/config)
- 注意: 如果 server IP 为 127.0.0.1,需要将 IP 替换为集群 master 节点 IP
证书
当前内容版权归 KubeOperator 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 KubeOperator .