https://dagster.io/ logo
#deployment-kubernetes
Title
# deployment-kubernetes
r

Rubén Lopez Lozoya

03/26/2021, 11:26 AM
Guys, any way to tell dagster to clean finished jobs after execution in kubernetes?
j

johann

03/26/2021, 1:17 PM
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

Dagster Bot

03/26/2021, 1:21 PM
r

Rubén Lopez Lozoya

03/26/2021, 1:35 PM
thanks!
n

Noah K

03/26/2021, 2:24 PM
TTL controller is moving to beta in 1.21 last I looked, so will be supported soon 🙂
👍 1
r

Rubén Lopez Lozoya

03/26/2021, 2:25 PM
amazing