How can we auto cleanup k8s worker pool's complete...
# ask-community
s
How can we auto cleanup k8s worker pool's completed and failed job I have setup prefect server and worker using helm chart, and was able to run seleral workflows. However I noticed that after flowrun complete, kubectl get pod shows the pods still exist. Here is my prefect.yaml
Copy code
name: flows
prefect-version: 2.14.2

# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.set_working_directory:
    directory: /opt/prefect

# the definitions section allows you to define reusable components for your deployments
definitions:
  tags: &common_tags
    - "sat"
  work_pool: &common_work_pool
    name: "k8s-pool"
    job_variables:
      image: "{{ build-image.image }}"

# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: "flow"
  schedule: null
  entrypoint: "src/sat/sub_flows/flow.py:flow"
  work_pool: *common_work_pool
Is there a flag jere where I can configure auto cleanup setting? Or perhaps in worker pool settings?
k
The kubernetes work pool has a
Finished Job TTL
which specifies:
The number of seconds to retain jobs after completion. If set, finished jobs will be cleaned up by Kubernetes after the given delay. If not set, jobs will be retained indefinitely.
👍 1
s
Great! I’ll try it out, thx