<p>I have a job definition based on example from kubernetes website.</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pi-with-timeout-6
spec:
  activeDeadlineSeconds: 30
  completions: 1
  parallelism: 1
  template:
    metadata:
      name: pi
    spec:
      containers:
      - name: pi
        image: perl
        command: [&quot;exit&quot;, &quot;1&quot;]
      restartPolicy: Never
</code></pre>
<p>I would like run this job once and not restart if fails. With comand exit 1 kubernetes trying to run new pod to get exit 0 code until reach activeDeadlineSeconds timeout. How can avoid that? I would like run build commands in kubernetes to check compilation and if compilation fails I'll get exit code different than 0. I don't want run compilation again.</p>
<p>Is it possible? How?</p>

<p>By now this is possible by setting <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#pod-backoff-failure-policy" rel="noreferrer"><code>backoffLimit: 0</code></a> which tells the controller to do 0 retries. default is 6</p>
