export kube config from an imported cluster of kuboard

从Kuboard中导出已导入的kube config

Kuboard使用的内置的etcd存储配置数据, 我这里是docker运行的Kuboard,其他运行方案也类似

1
2
3
4
5
docker exec -it {kuboard容器ID} bash
etcdctl get --prefix / | grep {导入的集群名}
# 一般是 /kind/KubernetesCluster/cluster/{导入的集群名}/{导入的集群名} 这样的key

etcdctl get /kind/KubernetesCluster/cluster/{导入的集群名}/{导入的集群名}

复制json其中的kubeconfig内容,把换行什么的删一删,最终拼成下面这样的yaml文件即可导入到其他kuboard中去

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: xxx
    server: https://xxxxxx:6443
  name: xxx
contexts:
- context:
    cluster: xxxx
    namespace: xxx
    user: xxxx
  name: config
current-context: config
kind: Config
preferences: {}
users:
- name: xxxx
  user:
    client-certificate-data: xxx
Licensed under CC BY-NC-SA 4.0
记录平时瞎折腾遇到的各种问题, 方便查找
使用 Hugo 构建
主题 Stack 3.29.0Jimmy 设计