<p>I am writing a script to delete multiple pods across multiple namespaces. 
The process is to first mark all the pods to delete with a label, like kill=true, and then to delete them all.</p>

<p>Script as below:</p>

<pre><code>kubectl label pods pod0 kill=true -n namespace0
kubectl label pods pod1 kill=true -n namespace0
kubectl label pods pod0 kill=true -n namespace1
kubectl label pods pod1 kill=true -n namespace1
......
kubectl delete pod -l kill=true --all-namespaces
</code></pre>

<p>When executing the last script, echo text is as below:</p>

<pre><code>pod "pod0" deleted
pod "pod1" deleted
pod "pod0" deleted
pod "pod1" deleted
......
</code></pre>

<p>I'll insert timestamp for each line by script, as I need to know the exact time each one is killed. But the problem is I can't identify which pod is exactly killed as namespace isn't showed and there're multiple pods with the same name. </p>

<p>Thus my questions are as below:</p>

<ol>
<li>Is it possible to make kubectl show namespace in the echo text?</li>
<li>If not, does kubectl guarantee the delete order in some way? Like sort by namespace, pod name?</li>
</ol>

Orpheus
<blockquote>
  <ol>
  <li>Is it possible to make kubectl show namespace in the echo text?</li>
  </ol>
</blockquote>

<p>No, I think this is hardcoded in kubectl.</p>

<blockquote>
  <ol start="2">
  <li>If not, does kubectl guarantee the delete order in some way? Like sort by namespace, pod name?</li>
  </ol>
</blockquote>

<p>It's possible that the pods within a namespace are deleted in alphabetical order, however, this is <em><strong>not guaranteed</strong></em>. It's also possible that the namespaces are iterated over in alphabetical order, however, this is <em><strong>not guaranteed</strong></em> as well. In short, it might work in a certain way in practice, but there are no guarantees that you can rely on.</p>

<p>Besides that, if you need to know the exact time that each pod is deleted, it's probably better to iterate through all the pods anyway and delete each one explicitly.</p>
