简体   繁体   English

Prometheus:监控外部 K8s 集群的更好选择

[英]Prometheus: Better Option to monitor external K8s Cluster

I have two kubernetes clusters who do not talk to one another in any way.我有两个 kubernetes 集群,它们不以任何方式相互交谈。 The idea is to maintain one prometheus instance(in another 3rd cluster) that can scrape endpoints from both the clusters.这个想法是维护一个 prometheus 实例(在另一个第三个集群中),它可以从两个集群中抓取端点。

I created a service account in each cluster, gave it cluster role & clusterrolebinding and took an yaml file of the secret.我在每个集群中创建了一个服务帐户,给它集群角色和集群角色绑定,并获取了一个 yaml 文件。 I then imported the same secret in the 3rd cluster where I have prometheus running.然后,我在运行 prometheus 的第三个集群中导入了相同的秘密。 Using these mounted secrets, I was able to pull data from all pods in cluster 1 and 2.使用这些挂载的秘密,我能够从集群 1 和集群 2 中的所有 pod 中提取数据。

Are there any better options to achieve this usecase?有没有更好的选择来实现这个用例? I am in a way transferring secrets from one cluster to another to get the same ca.crt and token.我以某种方式将机密从一个集群传输到另一个集群以获得相同的 ca.crt 和令牌。

I think it is not safe to share secrets between clusters.我认为在集群之间共享秘密是不安全的。

What about federation prometheus, one prometheus instance can export some data, which can be consumed by external prometheus instance.联邦普罗米修斯怎么样,一个普罗米修斯实例可以导出一些数据,这些数据可以被外部普罗米修斯实例消费。

For example, a cluster scheduler running multiple services might expose resource usage information (like memory and CPU usage) about service instances running on the cluster.例如,运行多个服务的集群调度程序可能会公开有关在集群上运行的服务实例的资源使用信息(如内存和 CPU 使用情况)。 On the other hand, a service running on that cluster will only expose application-specific service metrics.另一方面,在该集群上运行的服务只会公开特定于应用程序的服务指标。 Often, these two sets of metrics are scraped by separate Prometheus servers.通常,这两组指标由单独的 Prometheus 服务器抓取。

Or deploy some exporter, which can be consumed by external prometheus.或者部署一些exporter,可以被外部prometheus消费。 eg https://github.com/kubernetes/kube-state-metrics (but it is not providing cpu/memory usage of pods)例如https://github.com/kubernetes/kube-state-metrics (但它不提供 pod 的 CPU/内存使用情况)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM