user2425909
user2425909

Reputation: 87

Why do I see a "Running" pod as "Failed" in Prometheus query result when the pod never failed?

{__name__="kube_pod_status_phase",namespace="mynamespace",phase="Failed"}

When I run the aforementioned PromQL query, it also returns pods that have never failed (what I see in Kubernetes). The pod is in running status and has never failed or restarted. How is Prometheus marking it as "Failed"?

Upvotes: 0

Views: 4465

Answers (1)

Ali Tou
Ali Tou

Reputation: 2205

According to this, the kube_pod_status_phase metric is an enum metric, and exposes a time-series for each possible state. However, only the one the Pod is in has the value of 1.

So if you want to see actually Failed Pods, execute this query:

kube_pod_status_phase{namespace="mynamespace",phase="Failed"} == 1

Upvotes: 4

Related Questions