<p>I am trying to create a Kubernetes Job with a <code>backofflimit</code> value set to <code>4</code>. So I would want to know that if there's a Pod in the Job that is failed, I would want to wait for n minutes or n seconds before the second pod is created. Is there a way how I can do it?</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pi-test
spec:
  template:
    spec:
      containers:
      - name: pi
        image: bitnami/git:latest
        command: [&quot;/bin/bash&quot;,  &quot;-c&quot;, &quot;gits clone ls -b master&quot;]
      restartPolicy: OnFailure
  backoffLimit: 4
  activeDeadlineSeconds: 120

</code></pre>

Pavan
<p>You can achieve this by using <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-http-request" rel="nofollow noreferrer">liveness probe</a></p>
<p>See this example <code>Yaml</code> and <code>#you can change as per your need.</code></p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pi-test
spec:
  template:
    spec:
      containers:
        - name: pi
          image: bitnami/git:latest
          args:
            - /bin/sh
            - -c
            - touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600
          livenessProbe: # Check if healthy
            exec:
              command:
                - cat
                - /tmp/healthy
            initialDelaySeconds: 5
            periodSeconds: 5
          command: [&quot;/bin/bash&quot;,  &quot;-c&quot;, &quot;gits clone ls -b master&quot;]
      restartPolicy: OnFailure
  backoffLimit: 4
  activeDeadlineSeconds: 120
</code></pre>
<p><strong>Note for <code>initialDelaySeconds</code></strong>: If you don’t set the initial delay, the prober will start probing the container as soon as it starts, which usually leads to the probe failing, because the app isn’t ready to start receiving requests. If the number of failures exceeds the failure threshold, the con- tainer is restarted before it’s even able to start responding to requests properly.</p>
<p><strong>Note for Pod backoff failure policy:</strong> Failed Pods associated with the Job are recreated by the Job controller with an exponential back-off delay (10s, 20s, 40s ...) capped at six minutes. <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#pod-backoff-failure-policy" rel="nofollow noreferrer">Ref</a>:</p>
