From 82f847e21dc93c8fe218fefc6bdcb4f7ea6872fd Mon Sep 17 00:00:00 2001 From: Arcadie Condrat Date: Mon, 5 Sep 2022 11:34:39 +0200 Subject: [PATCH] Filter out non-running pods in Prometheus Prometheus job generated by the PodMonitor does not exclude non-running pods. All the "completed" Pods are still going to be listed as targets in Prometheus and marked as down. This issue is related to PodMonitor implementation and is discussed in prometheus-operator/prometheus-operator#4816 Signed-off-by: Arcadie Condrat --- manifests/monitoring/monitoring-config/podmonitor.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifests/monitoring/monitoring-config/podmonitor.yaml b/manifests/monitoring/monitoring-config/podmonitor.yaml index d375e0d9..5e4b3a8c 100644 --- a/manifests/monitoring/monitoring-config/podmonitor.yaml +++ b/manifests/monitoring/monitoring-config/podmonitor.yaml @@ -23,3 +23,8 @@ spec: - image-reflector-controller podMetricsEndpoints: - port: http-prom + relabelings: + # https://github.com/prometheus-operator/prometheus-operator/issues/4816 + - sourceLabels: [__meta_kubernetes_pod_phase] + action: keep + regex: Running