<p>When a container image is not present on the cluster the pod fails with the error <code>ErrImageNeverPull</code> but the job never fails. Is there a configuration that I can add to make sure the job fails if the pod startup fails.</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: image-not-present
spec:
  backoffLimit: 0
  ttlSecondsAfterFinished: 120
  template:
    spec:
      serviceAccountName: consolehub
      containers:
      - name: image-not-present
        image: aipaintr/image_not_present:latest
        imagePullPolicy: Never
      restartPolicy: OnFailure
</code></pre>

Saurabh Saxena
<p>You can config <strong>activeDeadlineSeconds</strong> for this case. However, you have know how long your job take to reach <strong>Complete</strong> status to avoid this timeout can kill your pod processing.</p>
<p>From the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#job-termination-and-cleanup" rel="nofollow noreferrer">documents</a>:</p>
<blockquote>
<p>The activeDeadlineSeconds applies to the duration of the job, no matter how many Pods are created. Once a Job reaches activeDeadlineSeconds, all of its running Pods are terminated and the Job status will become type: Failed with reason: DeadlineExceeded.</p>
</blockquote>
<p>For example: I have created job with wrong image and <strong>activeDeadlineSeconds</strong>: 100. Obviously, the pod stuck with status <strong>Pending</strong> because of wrong image.<a href="https://i.stack.imgur.com/e5y4i.png" rel="nofollow noreferrer">kubectl describe pod</a></p>
<p>After 100 seconds, the Job was <strong>Fail</strong> and the pod was killed as well.
<a href="https://i.stack.imgur.com/XJpT1.png" rel="nofollow noreferrer">kubectl describe job</a></p>
