Kube-janitor is a automation tool to clean up finished jobs in Kubernetes. It is designed to be highly configurable and deployable via helm.

Why

As of v1.11 Kubernetes does not clean up failed or successful jobs automatically.

When a Job completes, no more Pods are created, but the Pods are not deleted either. Keeping them around allows you to still view the logs of completed pods to check for errors, warnings, or other diagnostic output. The job object also remains after it is completed so that you can view its status. It is up to the user to delete old jobs after noting their status.

Although Kubernetes does provide an activeDeadlineSeconds on job configurations.

The activeDeadlineSeconds applies to the duration of the job, no matter how many Pods are created. Once a Job reaches activeDeadlineSeconds, the Job and all of its Pods are terminated. The result is that the job has a status with reason: DeadlineExceeded.

However this option has the potential to kill your job even before it’s finished. Kube-janitor aims to cleanup only after your job has finished regardless of failure or success.

Tell us about a new Kubernetes application

Newsletter

Never miss a thing! Sign up for our newsletter to stay updated.

About

Discover and learn about everything Kubernetes

Navigation