<p>Kubernetes CronJobs allow to specify following:</p>
<pre class="lang-yaml prettyprint-override"><code>successfulJobsHistoryLimit: 3 
failedJobsHistoryLimit: 1
</code></pre>
<p>However this is not the case for Kubernetes Jobs – these fields are undefined and the pods are immediately deleted after completion.</p>
<p>Is there a way to keep the jobs' pods after completion for inspection?</p>

Vojtěch
<p>The only way to keep alive is let him doing something.
When your job run and the work is finished it exits with code 0, when an error occours it exits with a different code.</p>
<p>If you need to access your container after the job is finished let him do someting like &quot;sleep infinity&quot;.....</p>
<p>In your podTemplate of your job.yaml</p>
<pre><code>    command:
    - sh
    - -c
    - |
      myjobcommand
      sleep 999999

</code></pre>
<p>Update</p>
<p>To log terminated pods use the -p switch</p>
<pre><code>kubectl logs podname -p -n mynamespace
</code></pre>
<p>it should work till 1 hour (default settings) after the pod terminated</p>
