Home > Mobile >  Autodiscover targets from containers
Autodiscover targets from containers

Time:01-21

We have multiple similar win apps running in docker containers. There also more than 1 container for some aplications. Each one has exporter running one the same port inside container (9182).

Is there any way for prometheus in the container to access their metrics automatically without exposing port for each container separatly and adding this targets in prometheus config manually for each service everytime?

CodePudding user response:

See Prometheus Operator and please read the distinction between it and kube-prometheus. The latter includes the former.

A key aspect of the Prometheus Operator is that it uses Custom Resources (e.g. ServiceMonitor and PodMonitor) to facilitate the automatic inclusion (aka Discovery) of Kubernetes Services (and Pods) into Prometheus.

I've not used it directly but Prometheus also includes Kubernetes service discovery (kubernetes_sd_config). This includes nodes, services, pods, endpoints etc.

  • Related