<p>When a POD is terminating,  how to get correct status <strong>Terminating</strong> using Kubernetes <strong>REST</strong> API. I am not able to figure it out.
But <strong>kubectl</strong> always report correct status,  and it also uses REST API to do that.</p>
<p>What magic am I missing in REST API ? does it call two different API's and accumulate status ?</p>

SuVeRa
<p>You are not the <a href="https://github.com/kubernetes/kubernetes/issues/22839" rel="nofollow noreferrer">first person to ask this question</a>. The answer appears to be that <code>kubectl</code> inspects <code>metadata.deletionTimestamp</code>; if this exists (and, presumably, has a non-null value) then the pod is in <code>Terminating</code> state.</p>
<p>For example, for a running pod:</p>
<pre><code>$ curl -s localhost:8001/api/v1/namespaces/mynamespace/pods/example | jq .metadata.deletionTimestamp
&lt;empty output&gt;
</code></pre>
<p>And then immediately after I <code>kubectl delete</code> the pod:</p>
<pre><code>$ curl -s localhost:8001/api/v1/namespaces/mynamespace/pods/example | jq .metadata.deletionTimestamp
&quot;2022-01-15T15:30:01Z&quot;
</code></pre>
