跳转至

了解 FIT2CLOUD 飞致云旗下开源产品

集群导入

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}'

cluster-import-token

kubeconfig 文件⚓︎

将任意集群节点 kubeconfig 文件拷贝到本机后导入(默认路径为: ~/.kube/config)

  • 注意: 如果 server IP 为 127.0.0.1,需要将 IP 替换为集群 master 节点 IP

cluster-import-kubeconfig

证书⚓︎

cluster-import-certificate