How to delete kubernetes failed/completed jobs

2.6k views Asked by At

How can I clean up the failed and completed pods created by kubernetes job automatically without using cronjob. I want to keep only the last pod created by job.

How can we accomplish that?

1

There are 1 answers

3
gohm'c On

...clean up the failed and completed pods created by kubernetes job automatically without using cronjob

If you specify ttlSecondsAfterFinished to the same period as the Job schedule, you should see only the last pod until the next Job starts. You can prolong the duration to keep more pods in the system this way and not wait until they are explicitly delete.