问题描述
我已在下文中配置了Prometheus进行监视。在下文中,我们正在运行一个EKS集群。我必须在Prometheus中收集EKS指标。
I have configured Prometheus in our infra for monitoring. In our infra, we have an EKS clusters running. I have to collect EKS metrics in Prometheus.
默认情况下,Prometheus使用基于拉的机制。在这里,我有一个关于如何从Kubernetes集群外部收集指标的问题。在这种情况下,流量将是Prometheus->入口控制器->公制吊舱。
By default, Prometheus work on a pull-based mechanism. Here I have a question on how to collect metrics from outside the Kubernetes cluster. In this case, traffic flow will be Prometheus --> Ingress controller --> Metric pod.
我正在寻找这种情况,但是许多人建议Prometheus应该位于Kubernetes集群中,然后才能正常工作。请建议任何人对于这种情况都有很好的解决方案。
有什么方法可以在Prometheus中推送Kubernetes指标吗?
I search for this kind of scenario, but many peoples suggested Prometheus should be in the Kubernetes cluster then only it will work. Please suggest anyone have a good solution for this kind of scenario.
Is there any way to push Kubernetes metrics in Prometheus?
推荐答案
您可以使用Prometheus联合身份验证()。
You can use Prometheus federation (https://prometheus.io/docs/prometheus/latest/federation/).
在您的情况下,您可以将Prometheus实例添加到EKS群集中,该实例将抓取所有群集指标,公开此Prometheus实例通过入口控制器,然后将指向入口的目标添加到外部Prometheus实例中。
In your case, you can add a Prometheus instance into the EKS cluster that will scrape all cluster metrics, expose this Prometheus instance through ingress controller, and then add a target pointing on the ingress into the external Prometheus instance.
这篇关于如何在Prometheus中推送Kuberntes指标而不是pull?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!