2

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.

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.

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?

Vishal Patil
  • 77
  • 1
  • 1
  • 7
  • 1
    You can eventually use push gateway (https://github.com/prometheus/pushgateway) but not sure it will be adapted to your case. – Alexandre Cartapanis Sep 19 '20 at 09:05
  • Take a look at [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics/) - it supports both [pull](https://victoriametrics.github.io/#how-to-scrape-prometheus-exporters-such-as-node-exporter) and [push protocols](https://victoriametrics.github.io/#how-to-import-time-series-data) for data collection. – valyala Sep 19 '20 at 21:55
  • What is the reason behind that need for "push" instead of "pull" (which is the way Prometheus is designed) ? – Nick Sep 21 '20 at 13:12

1 Answers1

4

You can use Prometheus federation (https://prometheus.io/docs/prometheus/latest/federation/).

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.

Alexandre Cartapanis
  • 1,513
  • 3
  • 15
  • 19