<p>I created a job,and rerun it several times。
When I delete this job. Only the latest pod be deleted.</p>
<p>How Can I delete these pods all.</p>

Lu Peng
<p><strong>For Cronjob</strong></p>
<p>You can use the <strong>successfulJobsHistoryLimit</strong> to manage the pod count, if you will set it to <strong>0</strong>, POD will get removed as soon as it complete it's execution successfully.</p>
<pre><code>successfulJobsHistoryLimit: 0
failedJobsHistoryLimit: 0
</code></pre>
<p>Read more at : <a href="https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#jobs-history-limits" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#jobs-history-limits</a></p>
<p>GCP ref : <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/cronjobs#history-limit" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/how-to/cronjobs#history-limit</a></p>
<p><strong>For Job</strong></p>
<p>If you are using job not cronjob you can use <code>ttlSecondsAfterFinished</code> - delete the job pod after set second automatically, you can set it accordingly keeping some buffer.</p>
<pre><code>ttlSecondsAfterFinished: 100
</code></pre>
<p>will solve your issue.</p>
<p>Example : <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically</a></p>
<p><strong>Extra</strong> :</p>
<p>You can delete those pods using simple command but that is one-time solution using the label in PODs or used in job</p>
<pre><code>kubectl delete pods -l &lt;labels&gt; -n &lt;namespace&gt;
</code></pre>
