Guys, any way to tell dagster to clean finished jo...
# deployment-kubernetes
r
Guys, any way to tell dagster to clean finished jobs after execution in kubernetes?
j
Hi @Rubén Lopez Lozoya, we use the TTL feature but unfortunately it’s not supported by many k8s distributions currently https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/#ttl-controller. As an alternative, you can use a cluster plugin that manages gc: https://github.com/lwolf/kube-cleanup-operator https://github.com/aramse/k8s-job-reaper
It’s also an option to just setup a cron job yourself, with the following commands. This example deletes dagster jobs older than one day:
kubectl get job | grep -e dagster-run -e dagster-job | awk 'match($4,/[0-9]+d/) {print $1}' | xargs kubectl delete job
This deletes completed pods older than 1 day:
kubectl get pod | grep -e dagster-run -e dagster-job | awk 'match($3,/Completed/) {print $0}' | awk 'match($5,/[0-9]+d/) {print $1}' | xargs kubectl delete pod
👍 1
👍🏾 1
@Dagster Bot docs K8s Job/Pod ttl help
d
r
thanks!
n
TTL controller is moving to beta in 1.21 last I looked, so will be supported soon 🙂
👍 1
r
amazing