Skip to content

什么是Clusterpedia

Clusterpedia 这个名称借鉴自 Wikipedia,是多集群的百科全书,其核心理念是收集、检索和简单控制多集群资源。
通过聚合收集多集群资源,在兼容 Kubernetes OpenAPI 的基础上额外提供更加强大的检索功能,让用户更方便快捷地在多集群中获取想要的任何资源。

// 中文官网
https://clusterpedia.io/zh-cn/about/

支持的功能

  • 支持复杂的检索条件、过滤条件、排序、分页等等
  • 支持查询资源时请求附带关系资源
  • 统一主集群和多集群资源检索入口
  • 兼容 kubernetes OpenAPI,可以直接使用 kubectl 进行多集群检索,而无需第三方插件或者工具
  • 兼容收集不同版本的集群资源,不受主集群版本约束
  • 资源收集高性能,低内存
  • 根据集群当前的健康状态,自动开始/停止资源收集
  • 插件化存储层,用户可以根据自己需求使用其他存储组件自定义存储层
  • 高可用

基于之前velero实验拓展

# kubectl get pediacluster
NAME      READY   VERSION   APISERVER
104-k8s   True    v1.26.6   https://10.1.6.104:6443
66-k8s    True    v1.19.0   https://10.2.6.66:16443
# ll pediacluster-66-k8s.yaml pediacluster-1016104-k8s.yaml 
-rw-r--r-- 1 root root 7760 5月  21 11:37 pediacluster-1016104-k8s.yaml
-rw-r--r-- 1 root root 7686 5月  21 11:28 pediacluster-66-k8s.yaml
我们这里可以看到自己的两个k8s集群环境已经可以展示了
如下的命令,可以看到数据中的一些信息已经已经记录了两个集群的信息
# kubectl exec -it pod/clusterpedia-internalstorage-mysql-7ddbffbcb9-8nm6r -n clusterpedia-system  -- bash
bash-4.4# mysql -uroot -p'dangerous0'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 8.1.0 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use clusterpedia;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select count(1) from clusterpedia.resources;
+----------+
| count(1) |
+----------+
|      819 |
+----------+
1 row in set (0.01 sec)


mysql> select r.id, r.group, r.version, r.resource, r.kind, r.name, r.namespace from clusterpedia.resources r order by id limit 60;
+----+-------+---------+------------------------+-----------------------+--------------------------------------------+----------------------+
| id | group | version | resource               | kind                  | name                                       | namespace            |
+----+-------+---------+------------------------+-----------------------+--------------------------------------------+----------------------+
|  1 |       | v1      | persistentvolumeclaims | PersistentVolumeClaim | internalstorage-mysql                      | clusterpedia-system  |
|  2 |       | v1      | configmaps             | ConfigMap             | coredns                                    | kube-system          |
|  3 |       | v1      | namespaces             | Namespace             | default                                    |                      |
|  4 |       | v1      | configmaps             | ConfigMap             | kube-proxy                                 | kube-system          |
|  5 |       | v1      | persistentvolumes      | PersistentVolume      | clusterpedia-internalstorage-mysql         |                      |
|  6 |       | v1      | namespaces             | Namespace             | kube-node-lease                            |                      |
|  7 |       | v1      | serviceaccounts        | ServiceAccount        | default                                    | kube-node-lease      |
|  8 |       | v1      | configmaps             | ConfigMap             | kubeadm-config                             | kube-system          |
|  9 |       | v1      | namespaces             | Namespace             | kube-public                                |                      |
| 10 |       | v1      | serviceaccounts        | ServiceAccount        | default                                    | kube-system          |
| 11 |       | v1      | configmaps             | ConfigMap             | kubelet-config-1.19                        | kube-system          |
| 12 |       | v1      | serviceaccounts        | ServiceAccount        | default                                    | zznodetest           |
| 13 |       | v1      | configmaps             | ConfigMap             | kubernetes-dashboard-settings              | kubernetes-dashboard |
| 14 |       | v1      | endpoints              | Endpoints             | dashboard-metrics-scraper                  | kubernetes-dashboard |
| 15 |       | v1      | namespaces             | Namespace             | kubernetes-dashboard                       |                      |
| 16 | apps  | v1      | controllerrevisions    | ControllerRevision    | restic-7c55dfb857                          | velero               |
| 17 | apps  | v1      | daemonsets             | DaemonSet             | kube-proxy                                 | kube-system          |
| 18 |       | v1      | serviceaccounts        | ServiceAccount        | clusterpedia-controller-manager            | clusterpedia-system  |
| 19 |       | v1      | configmaps             | ConfigMap             | cluster-info                               | kube-public          |
| 20 |       | v1      | services               | Service               | codebase-3749                              | zznodetest           |
| 21 |       | v1      | namespaces             | Namespace             | velero                                     |                      |
| 22 |       | v1      | endpoints              | Endpoints             | do-maintain-3756                           | zznodetest           |
| 23 | apps  | v1      | deployments            | Deployment            | cojenkins-3742                             | zznodetest           |
| 24 |       | v1      | nodes                  | Node                  | master-1                                   |                      |
| 25 | apps  | v1      | replicasets            | ReplicaSet            | minio-795cc9d577                           | velero               |
| 26 |       | v1      | configmaps             | ConfigMap             | extension-apiserver-authentication         | kube-system          |
| 27 |       | v1      | namespaces             | Namespace             | zcp                                        |                      |
| 28 | apps  | v1      | controllerrevisions    | ControllerRevision    | kube-proxy-5dcf4d9dff                      | kube-system          |
| 29 | apps  | v1      | daemonsets             | DaemonSet             | kube-flannel-ds                            | kube-flannel         |
| 30 |       | v1      | endpoints              | Endpoints             | codebase-3749                              | zznodetest           |
| 31 |       | v1      | serviceaccounts        | ServiceAccount        | default                                    | zcp                  |
| 32 |       | v1      | namespaces             | Namespace             | kube-system                                |                      |
| 33 | apps  | v1      | deployments            | Deployment            | environment-3751                           | zznodetest           |
| 34 |       | v1      | configmaps             | ConfigMap             | kube-flannel-cfg                           | kube-flannel         |
| 35 |       | v1      | pods                   | Pod                   | etcd-master-3                              | kube-system          |
| 36 |       | v1      | nodes                  | Node                  | master-2                                   |                      |
| 37 |       | v1      | serviceaccounts        | ServiceAccount        | default                                    | default              |
| 38 |       | v1      | endpoints              | Endpoints             | pipelinelayout-3752                        | zznodetest           |
| 39 | apps  | v1      | deployments            | Deployment            | artifact-3750                              | zznodetest           |
| 40 |       | v1      | namespaces             | Namespace             | kube-flannel                               |                      |
| 41 |       | v1      | configmaps             | ConfigMap             | clusterpedia-internalstorage               | clusterpedia-system  |
| 42 |       | v1      | pods                   | Pod                   | kube-apiserver-master-1                    | kube-system          |
| 43 |       | v1      | services               | Service               | application-3754                           | zznodetest           |
| 44 | apps  | v1      | daemonsets             | DaemonSet             | restic                                     | velero               |
| 45 |       | v1      | services               | Service               | pipelinelayout-3752                        | zznodetest           |
| 46 |       | v1      | serviceaccounts        | ServiceAccount        | attachdetach-controller                    | kube-system          |
| 47 |       | v1      | endpoints              | Endpoints             | clusterpedia-internalstorage-mysql         | clusterpedia-system  |
| 48 |       | v1      | nodes                  | Node                  | master-3                                   |                      |
| 49 |       | v1      | pods                   | Pod                   | kube-scheduler-master-3                    | kube-system          |
| 50 |       | v1      | serviceaccounts        | ServiceAccount        | certificate-controller                     | kube-system          |
| 51 |       | v1      | services               | Service               | environment-3751                           | zznodetest           |
| 52 |       | v1      | endpoints              | Endpoints             | kube-scheduler                             | kube-system          |
| 53 |       | v1      | namespaces             | Namespace             | zznodetest                                 |                      |
| 54 | apps  | v1      | replicasets            | ReplicaSet            | velero-55c755ddf5                          | velero               |
| 55 | apps  | v1      | controllerrevisions    | ControllerRevision    | kube-flannel-ds-549bcc7d65                 | kube-flannel         |
| 56 | apps  | v1      | deployments            | Deployment            | clusterpedia-clustersynchro-manager        | clusterpedia-system  |
| 57 |       | v1      | services               | Service               | artifact-3750                              | zznodetest           |
| 58 |       | v1      | serviceaccounts        | ServiceAccount        | deployment-controller                      | kube-system          |
| 59 |       | v1      | pods                   | Pod                   | minio-setup-jrs4h                          | velero               |
| 60 | apps  | v1      | replicasets            | ReplicaSet            | clusterpedia-controller-manager-5989fc4c7f | clusterpedia-system  |
+----+-------+---------+------------------------+-----------------------+--------------------------------------------+----------------------+
60 rows in set (0.00 sec)

mysql> 

Clusterpedia能做哪些事情

https://clusterpedia.io/zh-cn/about/

基于中文官网的拓展延伸如下