<p>I currently use the following script to wait for the job completion</p>

<p><code>ACTIVE=$(kubectl get jobs my-job -o jsonpath='{.status.active}')
until [ -z $ACTIVE ]; do ACTIVE=$(kubectl get jobs my-job -o jsonpath='{.status.active}') ; sleep 30 ; done
</code></p>

<p>The problem is the job can either fail or be successful as it is a test job.</p>

<p>Is there a better way to achieve the same?</p>

<p>Yes. As I pointed out in <a href="https://hackernoon.com/kubectl-tip-of-the-day-wait-like-a-boss-40a818c423ac" rel="nofollow noreferrer">kubectl tip of the day: wait like a boss</a>, you can use the <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait" rel="nofollow noreferrer">kubectl wait</a> command.</p>
