All Projects → theMagicalKarp → kube-janitor

theMagicalKarp / kube-janitor

Licence: MIT license
Kubernetes Job Cleaner

Programming Languages

go
31211 projects - #10 most used programming language
Smarty
1635 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to kube-janitor

drone-gcloud-helm
Drone 0.5 plugin to create and deploy Helm charts for Kubernetes in Google Cloud.
Stars: ✭ 13 (-64.86%)
Mutual labels:  helm
tacoplay
a set of playbooks to deploy taco, leveraging ironic, kubespray, rook-ceph, decapod (kustomize, argo-wf, argo-cd)
Stars: ✭ 34 (-8.11%)
Mutual labels:  helm
cog-helm
A Helm chart to deploy Cog on Kubernetes
Stars: ✭ 17 (-54.05%)
Mutual labels:  helm
karvdash
Knot provides a complete environment for unleashing your productivity on Kubernetes
Stars: ✭ 30 (-18.92%)
Mutual labels:  helm
helmwave
🌊 Helmwave is the true release manager
Stars: ✭ 488 (+1218.92%)
Mutual labels:  helm
helm-freeze
Freeze your charts in the wished versions
Stars: ✭ 29 (-21.62%)
Mutual labels:  helm
action-setup-kube-tools
Github Action that setup Kubernetes tools (kubectl, kustomize, helm, kubeconform, conftest, yq, rancher, tilt, skaffold) very fast and cache them on the runner. Please [✩Star] if you're using it!
Stars: ✭ 45 (+21.62%)
Mutual labels:  helm
bitops
Automate the provisioning and configuration of cloud infrastructure.
Stars: ✭ 28 (-24.32%)
Mutual labels:  helm
matrix-chart
Helm chart for deploying a Matrix homeserver stack
Stars: ✭ 83 (+124.32%)
Mutual labels:  helm
NodeWrecker
Simple pod to run in kubernetes to stress test your nodes
Stars: ✭ 27 (-27.03%)
Mutual labels:  helm
cmak-operator
CMAK (prev. Kafka Manager) for Kubernetes
Stars: ✭ 45 (+21.62%)
Mutual labels:  helm
jpetstore-kubernetes
Modernize and Extend: JPetStore on IBM Cloud Kubernetes Service
Stars: ✭ 21 (-43.24%)
Mutual labels:  helm
kube-tools-aws
A lightweight Docker image with various CLI tooling for working with Kubernetes.
Stars: ✭ 26 (-29.73%)
Mutual labels:  helm
helm-charts
OpenSourced Helm charts
Stars: ✭ 38 (+2.7%)
Mutual labels:  helm
gcloud-kubectl-helm
Docker image for the quaternity of gcloud, helm, kubectl and SOPS
Stars: ✭ 32 (-13.51%)
Mutual labels:  helm
kube-opennebula
Helm chart and OpenNebula images ready to deploy on Kubernetes
Stars: ✭ 43 (+16.22%)
Mutual labels:  helm
drone-helm3
Helm3 plugin for Drone CI
Stars: ✭ 20 (-45.95%)
Mutual labels:  helm
helm-charts
Helm charts for Vector.
Stars: ✭ 50 (+35.14%)
Mutual labels:  helm
tiller-multiarch
Helm Tiller images for amd64, arm64, and armhf. ⚓️🎉
Stars: ✭ 80 (+116.22%)
Mutual labels:  helm
kube-test-container
Kubernetes Test Container
Stars: ✭ 27 (-27.03%)
Mutual labels:  helm

kube-janitor

Build Status Go Report Card

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

the-kube-janitor

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.

Requirements

Getting Started

To immediately install kube-janitor run the following commands.

helm repo add themagicalkarp https://themagicalkarp.github.io/charts
helm upgrade --install kube-janitor --namespace kube-system themagicalkarp/kube-janitor

This'll register https://themagicalkarp.github.io/charts as repo in your helm client and deploy kube-janitor to your cluster.

If you don't want to install helm in your cluster you can render the configuration and pipe it to kubectl.

helm template kube-janitor --name kube-janitor | kubectl create -f -

Options

CMD Params

These are flags you can specify when invoking the kube-janitor binary directly located in the docker image.

  • -annotation="kube.janitor.io" The prefix to use when looking for kube-janitor annotations
  • -namespace="" The namespace to target for cleanup. By default checks all namespaces
  • -expiration=60 The amount of minutes before a job is considered expired and therefore targeted for deletion.
  • -verbose If present logs detailed information on jobs found and deleted
  • -dryrun If present prevents any job deletions from occuring

Job Annotations

These are annotations you can specify per job to configure kube-janitor behavior.

  • kube.janitor.io/expiration A float, that if specified, overrides the expiration limit for the job
  • kube.janitor.io/ignore A boolean, that if true, kube-janitor ignores

Build/Test

Docker is the source of truth for building and testing the code. This Dockerfile runs the tests and ensures correct formatting. If either of those steps fail we prevent the image from being built.

docker build -t kube-janitor:latest .

Local Development with Minikube

Requirements

To build and deploy locally into your Minikube cluster run the following commands.

eval $(minikube docker-env)
docker build -t themagicalkarp/kube-janitor:local .
helm init
helm install kube-janitor --set image.tag="local" --set image.pullPolicy="Never"

What's Next

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].