<p>I'm working on the manifest of a kubernetes <code>job</code>. </p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: hello-job
spec:
  template:
    spec:
      containers:
      - name: hello
        image: hello-image:latest
</code></pre>

<p>I then apply the manifest using <code>kubectl apply -f &lt;deployment.yaml&gt;</code> and the job runs without any issue. </p>

<p>The problem comes when i change the image of the running container from <code>latest</code> to something else. </p>

<p>At that point i get a <code>field is immutable</code> exception on applying the manifest. </p>

<p>I get the same exception either if the job is running or completed. The only workaround i found so far is to delete manually the job before applying the new manifest. </p>

<p>How can i update the current job without having to manually delete it first? </p>

<p>I guess you are probably using an incorrect kubernetes resource . <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="noreferrer">Job</a> is a immutable Pod that runs to completion , you cannot update it . As per Kubernetes documentation ..</p>

<blockquote>
  <p>Say Job old is already running. You want existing Pods to keep running, but you want the rest of the Pods it creates to use a different pod template and for the Job to have a new name. You cannot update the Job because these fields are not updatable. Therefore, you delete Job old but leave its pods running, using kubectl delete jobs/old --cascade=false. </p>
</blockquote>

<p>If you intend to update an image you should either use Deployment or Replication controller which supports updates</p>
