This is a Helm chart for Kubernetes that automates the cleanup of failed pods across all namespaces. It uses a CronJob
to periodically execute the kubectl delete pods
command to remove pods that are in the Failed
state.
- Kubernetes 1.25+
- Helm 3.0+
The default values for this chart are defined in the values.yaml
file. You can customize the settings by passing your own values during installation:
helm install pod-cleanup oci://ghcr.io/cubos/charts/pod-cleanup \
--set podCleanup.schedule="0 2 * * *" \
--version <version>
podCleanup.cleanupContainer.image.repository
: Repository of the cleanup container image (default:bitnami/kubectl
).podCleanup.cleanupContainer.image.tag
: Tag of the cleanup container image (default:latest
).podCleanup.schedule
: Cron schedule for theCronJob
(default:0 3 * * *
).podCleanup.serviceAccount.annotations
: Annotations for the service account.
This chart creates a CronJob
that executes the command kubectl delete pods --field-selector status.phase==Failed --all-namespaces
according to the configured cron schedule. Ensure that the service account has the necessary permissions to list and delete pods.
PRs are welcome! Please make sure to check ESLint and Prettier before submitting a PR.
By submitting a PR, you agree to license your work under the GNU Lesser General Public License v3.0.