Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.08 KB

README.md

File metadata and controls

56 lines (44 loc) · 1.08 KB

Cleanup your Kubernates!

Installation

This python package do not exists in PyPi. Use only with Docker.

Build

docker build -t zzzsochi/kubecleaner .

Usage:

$ docker run -it --rm -v $HOME/.kube/config:/root/.kube/config:ro zzzsochi/kubecleaner --help
 Kubernetes cleaner.

Usage:
  kubecleaner [-n <namespace>] [--dry] jobs <name>

Commands:
  jobs  Delete completed jobs

Global options:
  -h --help     Show this screen.
  -n NAMESPACE  K8S namespace [default: default]
  --dry         Run without deletion
docker run -it --rm -v $HOME/.kube/config:/root/.kube/config:ro zzzsochi/kubecleaner jobs '*'
---
kind: CronJob
apiVersion: batch/v1beta1
metadata:
  name: cleanup-jobs

spec:
  schedule: "0 */24 * * *"
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 4
  jobTemplate:
    spec:
      template:
        spec:
          automountServiceAccountToken: true
          restartPolicy: OnFailure
          containers:
          - name: cleaner
            image: zzzsochi/kubecleaner
            command: ["jobs", "drone-job-*"]