<p>This is realy two questions in one - I think they are related.</p>
<h2>What does the <code>kube_pod_status_phase</code> metric <em>value</em> represent?</h2>
<p>When I view the <code>kube_pod_status_phase</code> metric in Prometheus, the metric value is always a 0 or 1, but it's not clear to me what 0 and 1 means. Let's use an example. The query below returns the value of this metric where the &quot;phase&quot; label equals &quot;Running&quot;.</p>
<p>Query:</p>
<pre><code>kube_pod_status_phase{phase=&quot;Running&quot;}
</code></pre>
<p>Result: (sample)</p>
<pre><code>kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;argocd&quot;, phase=&quot;Running&quot;, pod=&quot;argocd-server-6f8487c84d-5qqv7&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;ee84e48d-0302-4f5a-9e81-f4f0d7d0223f&quot;}
1
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;default&quot;, phase=&quot;Running&quot;, pod=&quot;rapid7-monitor-799d9f9898-fst5q&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;1561cd66-b5c4-48b9-83d0-11f4f1f0d5d9&quot;}
1
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Running&quot;, pod=&quot;clean-deploy-cronjob-28112310-ljws6&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;5510f859-74ca-471f-9c50-c1b8976119f3&quot;}
0
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Running&quot;, pod=&quot;clean-deploy-cronjob-28113750-75m8v&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;d63e5038-a8bb-4f88-bd77-82c66d183e1b&quot;}
0
</code></pre>
<p>Why do some &quot;running&quot; pods have a value of 0, while others have a value of 1? Are the items with a value of 1 &quot;currently&quot; running (at the time the query was run) and the items with a value of 0 &quot;had been&quot; running, but are no longer?</p>
<h2>There seem to be inconsistencies with what the <code>kube_pod_status_phase</code> metric produces between Prometheus and Grafana. Why?</h2>
<p>If I use a slightly different version of the query above, I get different results between Prometheus and what is shown in Grafana.</p>
<p>Query:</p>
<pre><code>kube_pod_status_phase{phase=~&quot;Pending&quot;} != 0
</code></pre>
<p>Result: (Prometheus}</p>
<pre><code>empty query result
</code></pre>
<p>Result: (Grafana table view)</p>
<pre><code>pod                                 namespace   phase
clean-deploy-cronjob-28115190-2rhv5 deploy      Pending
</code></pre>
<p>If I go back to Prometheus and focus on that pod specifically:</p>
<p>Query:</p>
<pre><code>kube_pod_status_phase{pod=&quot;clean-deploy-cronjob-28115190-2rhv5&quot;}
</code></pre>
<p>Result:</p>
<pre><code>kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Failed&quot;, pod=&quot;clean-deploy-cronjob-28115190-2rhv5&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;4dd948f6-327b-4c00-abc9-57d16bd588d0&quot;}
0
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Pending&quot;, pod=&quot;clean-deploy-cronjob-28115190-2rhv5&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;4dd948f6-327b-4c00-abc9-57d16bd588d0&quot;}
0
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Running&quot;, pod=&quot;clean-deploy-cronjob-28115190-2rhv5&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;4dd948f6-327b-4c00-abc9-57d16bd588d0&quot;}
0
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Succeeded&quot;, pod=&quot;clean-deploy-cronjob-28115190-2rhv5&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;4dd948f6-327b-4c00-abc9-57d16bd588d0&quot;}
1
kube_pod_status_phase{container=&quot;kube-state-metrics&quot;, endpoint=&quot;http&quot;, instance=&quot;10.244.211.138:8080&quot;, job=&quot;kube-state-metrics&quot;, namespace=&quot;deploy&quot;, phase=&quot;Unknown&quot;, pod=&quot;clean-deploy-cronjob-28115190-2rhv5&quot;, service=&quot;prometheus-kube-state-metrics&quot;, uid=&quot;4dd948f6-327b-4c00-abc9-57d16bd588d0&quot;}
0
</code></pre>
<p>Notice that the entry with phase &quot;Running&quot; has a value of 0, while the entry with a value of 1 has the phase &quot;Succeeded&quot;. You could argue that the status changed during the period when I ran these queries. No, it has not. It has been showing these results for a long time.</p>
<p>This is just one example of strange inconsistencies I've seen between a query run in Prometheus vs. Grafana.</p>
<p><strong>UPDATE</strong>:</p>
<p>I think I have gained some insight into the inconsistencies question. When I run the query in Prometheus it gives me the results as of &quot;now&quot; (a guess on my part). In Grafana, it takes into account the &quot;time window&quot; that's available in the dashboard header. When I dialed it back to &quot;the last 5 minutes&quot;, the pending entry disappeared.</p>
<p>I see that there is an option at the dashboard level in Grafana to hide the time picker, which if set to hide, hides not only the time picker, but also the refresh period selector. If this option is used, I'm curious as to how often the dashboard is <em>actually</em> refreshed. Should I use this to effectively make Grafana only care about &quot;now&quot;, instead of some time window into the past?</p>

Joseph Gagnon
<blockquote>
<h5>What does the <code>kube_pod_status_phase</code> metric value represent?</h5>
</blockquote>
<p><code>kube_pod_status_phase</code> contains a set of metrics for every pod with label <code>phase</code> being set to &quot;Failed&quot;, &quot;Pending&quot;, &quot;Running&quot;, &quot;Succeeded&quot;, &quot;Unknown&quot;.</p>
<p>Only one of those metrics (for every pod) will have value 1. It means that pod is in corresponding phase.</p>
<blockquote>
<p>Why do some &quot;running&quot; pods have a value of 0, while others have a value of 1?</p>
</blockquote>
<p>Remember, that Prometheus is not real time solution. It has values only with resolution of <code>scrape_interval</code>. Check suspicious pods for other states, it's quite possible, that pod's state wasn't updated. Plus, for short-lived pods all kinds of strange behavior in metrics is possible.</p>
<blockquote>
<h5>There seem to be inconsistencies with what the kube_pod_status_phase metric produces between Prometheus and Grafana. Why?</h5>
</blockquote>
<p>Most likely your query in Grafana has type &quot;Range&quot; or &quot;Both&quot; and in table mode it shows all values over time range selected for dashboard.</p>
<p>If you only want to see last values (according to &quot;To&quot; value of dashboard time range), you can go to query options (under query in panel edit mode) and set type to &quot;Instant&quot;.</p>
<blockquote>
<p>I see that there is an option at the dashboard level in Grafana to hide the time picker, which if set to hide, hides not only the time picker, but also the refresh period selector. If this option is used, I'm curious as to how often the dashboard is actually refreshed. Should I use this to effectively make Grafana only care about &quot;now&quot;, instead of some time window into the past?</p>
</blockquote>
<p>No. This is for other uses. For example for presentation mode.</p>
