<p>We have recently introduced Karpenter autoscaler in our Kubernetes infrastructure.</p>
<p>One of its strength is the <a href="https://karpenter.sh/preview/concepts/deprovisioning/" rel="nofollow noreferrer">deprovisioning mechanism</a>.</p>
<p>However given that we have a lot of stateful workload, this can cause some serious issue at time. We are taking several measures to somewhat control it.</p>
<p>Meanwhile, we realize that we have no ways to observe how the measures we take mitigate the issue.</p>
<p>Hence the question: Is there way to monitor Kubernetes POD movements, i.e. tracking how many time a POD (not the containers) may have been re-scheduled / restarted to move from a node to another, etc....</p>

MaatDeamon
<p>There is a metric in kubelet <code>kube_pod_status_scheduled_time</code> you could use. If the <code>start time</code> is more than <code>scheduled time</code>, it is scheduled:</p>
<pre><code>kube_pod_start_time{namespace=&quot;my-ns&quot;} - kube_pod_status_scheduled_time{namespace=&quot;my-ns&quot;} &gt; 0
</code></pre>
<p>You can also find the status of pods (<code>Evicted</code>, <code>NodeAffinity</code>, <code>Shutdown</code> ...) , with the metric <code>kube_pod_status_reason</code>.</p>
