Jay Taylor's notes
back to listing indexonfido/k8s-cleanup
[web search]
Original source (github.com)
Clipped on: 2018-09-26
- View Repository
-
Watch
-
Fork
onfido/k8s-cleanup
Kubernetes cleanup
Dockerfile | Using latest alpine (#5) | 2 days ago | |
LICENSE | Initial commit | a year ago | |
README.md | Updated README.md | 8 months ago | |
docker-clean.sh | Don't run docker rm/rmi if no container/image to remove. | 2 months ago | |
docker-clean.yml | Updated rbac and added update strategy to DS | 11 months ago | |
etcd-empty-dir-cleanup.sh | Add etcd-empty-dir-cleanup.yml cleanup inspired from kubernetes project | 11 months ago | |
etcd-empty-dir-cleanup.yml | Updated rbac and added update strategy to DS | 11 months ago | |
k8s-clean.sh | Small delay between deletes to reduce load on k8s API | 7 months ago | |
k8s-clean.yml | Run cronjob every 3h instead of 4h | 8 months ago | |
rbac.yml | Updated rbac and added update strategy to DS | 11 months ago |
README.md
k8s-cleanup
Here are 3 cleanups you can apply on your kubernetes cluster:
- Cleans up exited containers and dangling images/volumes running as a DaemonSet (
docker-clean.yml
). - Cleans up old replica sets, finished jobs and unrecycled evicted pods as a CronJob (
k8s-clean.yml
). - Cleans up empty directory (not used anymore) in etcd as a CronJob (
etcd-empty-dir-cleanup.yml
).
You must have batch/v2alpha1
enabled on your k8s API server runtime config in order to run the CronJob.
Env vars
In the DaemonSet (docker-clean.yml
) you can set DOCKER_CLEAN_INTERVAL
to modify the interval when it cleans up exited containers and dangling images/volumes; defaults to 30min (1800s).
In the CronJob (k8s-clean.yml
) you can set DAYS
to modify the maximum age of replica sets; defaults to 7 days.
Deployment
kubectl --context CONTEXT -n kube-system apply -f rbac.yml
kubectl --context CONTEXT -n kube-system apply -f docker-clean.yml
kubectl --context CONTEXT -n kube-system apply -f k8s-clean.yml
kubectl --context CONTEXT -n kube-system apply -f etcd-empty-dir-cleanup.yml
Press h to open a hovercard with more details.