<p>For tests, I want to have a way of waiting until a Deployment (replicas: 0) is really gone.</p>

<p>It seems like the Deployment Status is not waiting for all Pods to actually be terminated.</p>

<p>So I am wondering what the idiomatic way of waiting for a Deployment to be terminated is.
In other words, I want to have synchronous Delete of a Resource in Kubernetes, which also only returns after all Owning Resources (recursively) got deleted.</p>

abergmeier
<p>I think that Kubernetes 1.11+ already waits for the deletion to be completed before delete returns:</p>

<blockquote>
  <p><code>kubectl delete --help | grep '\-\-wait'</code><br>
  --wait=true: If true, wait for resources to be gone before returning. This waits for finalizers.</p>
</blockquote>

<p>Even so, you can use <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait" rel="nofollow noreferrer"><code>kubectl wait</code></a> to wait for a resource deletion:</p>

<blockquote>
  <p>Wait for a specific condition on one or many resources. Alternatively,
  the command can wait for the given set of resources to be deleted by
  providing the "delete" keyword as the value to the <code>--for</code> flag.</p>
</blockquote>

<p>e.g: <code>kubectl wait deployment/my-deployment --for=delete</code></p>
