<p>I understand that Kubernetes CronJobs create pods that run on the schedule specified inside the CronJob. However, the retention policy seems arbitrary and I don't see a way where I can retain failed/successful pods for a certain period of time.</p>

gabbar0x
<p>I am not sure about what you are exactly asking here.</p>
<p>CronJob does not create pods. It creates Jobs (which also manages) and those jobs are creating pods.
As per Kubernetes <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="nofollow noreferrer">Jobs Documentation</a> If the Jobs are managed directly by a higher level controller, such as CronJobs, the Jobs can be cleaned up by CronJobs based on the specified capacity-based cleanup policy. In short, pods and jobs will not be deleted utill you remove CronJob. You will be able to check logs from Pods/Jobs/CronJob. Just use kubctl describe </p>
<p>As default CronJob keeps history of 3 successfulJobs and only 1 of failedJob. You can change this limitation in CronJob spec by parameters:</p>
<pre><code>spec:
  successfulJobsHistoryLimit: 10
  failedJobsHistoryLimit: 0
</code></pre>
<p>0 means that CronJob will not keep any history of failed jobs <br/>
10 means that CronJob will keep history of 10 succeeded jobs</p>
<p>You will not be able to retain pod from failed job because, when job fails it will be restarted until it was succeded or reached backoffLimit given in the spec.</p>
<p>Other option you have is to suspend CronJob.</p>
<pre><code>kubctl patch cronjob &lt;name_of_cronjob&gt; -p '{&quot;spec:&quot;{&quot;suspend&quot;:true}}'
</code></pre>
<p>If value of spuspend is true, CronJob will not create any new jobs or pods. You will have access to completed pods and jobs.</p>
<p>If none of the above helpd you, could you please give more information what do you exactly expect? <br/>
CronJob spec would be helpful.</p>
