<p>I have a pod spec which runs a command like <code>rm -rf /some/path</code></p>
<p>i create the pod using <code>kubectl apply -f ...</code></p>
<p>now i want to wait till the pod completes.
i can see that the pod is done, <code>kubectl get pod/&lt;mypod&gt;</code> shows <code>STATUS Completed</code></p>
<p>How do i wait for this condition?</p>
<p>i have looked at <code>kubectl wait ...</code> but  that doesnt seem to help me</p>
<p><code>kubectl wait --for=condition=complete pod/&lt;my-pod&gt;</code> seems to just block.
I havent deleted the pod, it is still there in the Completed status</p>

<p>The command that you use: <code>kubectl wait --for=condition=complete pod/&lt;my-pod&gt;</code> will not work because a pod doesn't have such condition. <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions" rel="noreferrer">Pod Conditions</a> are as follows:</p>
<ul>
<li><p><code>PodScheduled</code>: the Pod has been scheduled to a node.</p>
</li>
<li><p><code>ContainersReady</code>: all containers in the Pod are ready.</p>
</li>
<li><p><code>Initialized</code>: all init containers have started successfully.</p>
</li>
<li><p><code>Ready</code>: the Pod is able to serve requests and should be added to the load balancing pools of all matching Services.</p>
</li>
</ul>
<p>The <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase" rel="noreferrer">phase</a> for a successfully completed pod is called <code>succeeded</code>:</p>
<blockquote>
<p>All containers in the Pod have terminated in success, and will not be
restarted.</p>
</blockquote>
<p>It would be better however if you use <code>kubectl wait</code> for <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="noreferrer">Jobs</a> instead of bare Pods and than execute <code>kubectl wait --for=condition=complete job/myjob</code>.</p>
