title: Is there a way to wait for all pod from a k8s deployment to be stopped?
body: <p>When deleting a pod manually <code>kubectl delete</code> wait for the pod to be deleted and one can include a <code>kubectl wait --for....</code> condition in a script to wait for the pod to be deleted.</p>
  <p>I would like to perform the same wait condition but when scaling down (replicas: 0) a deployment.</p>
  <p>From the deployment json, the available/unavailable replicas doesn't count the &quot;terminating&quot; pods and as expected <code>kubectl wait --for=delete deployment test-dep</code> doesn't wait for pod termination but for deployment deletion.</p>
  <p>So I would like to perform on my script:</p>
  <pre><code>kubectl scale --replicas=0 deployment foo-bar
  kubectl wait --for=deletion-of-pod-from-deploymenent=foo-bar
  </code></pre>
  <p>Is there a way to do that?</p>
  <p>Remarks: I would like to have the code as generic as possible so no hard writing the labels from deployment.</p>