<p>I have a cronjob that runs every 10 minutes. So every 10 minutes, a new pod is created. After a day, I have a lot of completed pods (not jobs, just one cronjob exists). Is there way to automatically get rid of them?</p>

<p>That's a work for labels.</p>

<p>Use them on your <code>CronJob</code> and delete completed pods using a <code>selector</code> (<code>-l</code> flag).</p>

<p>For example:</p>

<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: my-cron
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: periodic-batch-job
            is-cron: "true"
        spec:
          containers:
          - name: cron
            image: your_image
            imagePullPolicy: IfNotPresent
          restartPolicy: OnFailure
</code></pre>

<p>Delete all cron-labeled pods with:</p>

<pre><code>kubect delete pod -l is-cron
</code></pre>
