<p>I'm working with Kubernetes 1.26 on the server side (EKS) and kubectl client 1.27.1.</p>
<p>I have a job define in this way:</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: build
spec:
  template:
    spec:
      restartPolicy: Never
      volumes:
          .....
      containers:
          - name: build-tool
          ....
</code></pre>
<p>My pod dies for OOMKilled or some other reason, then Kubernetes launches another pod.
Why?</p>
<p>It is supposed not to be restarted.</p>
<p>Related reading:</p>
<ul>
<li><a href="https://www.aquasec.com/cloud-native-academy/kubernetes-101/kubernetes-jobs/" rel="nofollow noreferrer">https://www.aquasec.com/cloud-native-academy/kubernetes-101/kubernetes-jobs/</a></li>
<li><a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/job/</a></li>
</ul>

david.perez
<p>I think you missed this section of the documentation:</p>
<blockquote>
<p>An entire Pod can also fail, for a number of reasons, such as when the pod is kicked off the node (node is upgraded, rebooted, deleted, etc.), or if a container of the Pod fails and the .spec.template.spec.restartPolicy = &quot;Never&quot;. <strong>When a Pod fails, then the Job controller starts a new Pod.</strong> This means that your application needs to handle the case when it is restarted in a new pod. In particular, it needs to handle temporary files, locks, incomplete output and the like caused by previous runs.</p>
</blockquote>
<p>The value of <code>spec.template.spec.restartPolicy</code> effects the response to failed <em>containers</em> in your Pod (<a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" rel="nofollow noreferrer">docs</a>), but is not relevant to failures of the pod itself.</p>
<p>You can control how the Job controller responds to a failed <em>Pod</em> by setting a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#pod-failure-policy" rel="nofollow noreferrer">podFailurePolicy</a>.</p>
