When a pod is being deleted Kubernetes adds a label "deletionTimestamp" to the pod metadata. This seems to be what prompts kubectl
to display a pod as "terminating."
With jq
for instance you could report the status like this:
curl ... | jq -r '[.items[] | {
"namespace": .metadata.namespace,
"name": .metadata.name,
"status": (if .metadata.deletionTimestamp then "Terminating" else .status.phase end)
}]'
which would produce output like this:
[
{
"namespace": "my-namespace",
"name": "pod-A",
"status": "Running"
},
{
"namespace": "my-namespace",
"name": "pod-B",
"status": "Terminating"
},
...
]