<p>I'm looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup. </p>

<p>What would be a good way to do this? Would the best way be to run <code>kubectl describe job &lt;job_name&gt;</code> and grep for <code>1 Succeeded</code> or something of the sort?</p>

<p>Since version 1.11, you can do:</p>

<pre><code>kubectl wait --for=condition=complete job/myjob
</code></pre>

<p>and you can also set a timeout:</p>

<pre><code>kubectl wait --for=condition=complete --timeout=30s job/myjob
</code></pre>
