Skip to main content
When workflows generate artifacts and logs over time, stored files consume space in your artifact repository. Artifact Garbage Collection (Artifact GC) in Argo Workflows lets you automatically remove artifacts you no longer need. You can configure deletion either when a workflow completes or when a workflow is deleted. Artifact GC can be set globally at the workflow level (as a default for all artifacts) and selectively overridden per artifact.
Artifact-level settings override the workflow-level default. The available strategies are: OnWorkflowDeletion, OnWorkflowCompletion, and Never.
This document provides two practical examples and explains common behaviors and lifecycle considerations:
  • Example 1 — A workflow-level default GC strategy with an artifact-level override.
  • Example 2 — A producer-consumer steps workflow that passes an artifact between steps while using a workflow-level GC policy.
Example 1 — Workflow-level Artifact GC with an artifact-level override
  • Purpose: Demonstrates setting a default artifact GC strategy at the workflow level and overriding it for a specific artifact.
  • Behavior: The workflow default is OnWorkflowDeletion. One artifact will follow that policy; another will override it to OnWorkflowCompletion.
Example 2 — Steps-based producer/consumer (passing artifacts between steps)
  • Purpose: Shows a multi-step workflow that produces an artifact in one step and consumes it in another.
  • Behavior: The workflow-level artifactGC is set to OnWorkflowDeletion and applies to artifacts unless individually overridden.
A screenshot of the Argo Workflows web UI showing a "Submit new workflow" panel with options to select a workflow template or edit using full workflow options. The left sidebar displays workflow summary stats and namespace/filters.
How Artifact GC behaves in practice
  • workflow-level default: With artifactGC.strategy: OnWorkflowDeletion at the workflow level, artifacts produced by that workflow are removed when the workflow is deleted.
  • artifact-level overrides: To change behavior for specific artifacts, set artifactGC.strategy on the artifact:
    • Never — retain the artifact regardless of workflow deletion.
    • OnWorkflowCompletion — delete the artifact when the workflow completes (not waiting for deletion).
    • OnWorkflowDeletion — delete the artifact only when the workflow is deleted (this is the default in our examples).
  • precedence: Artifact-level settings always override the workflow-level default.
Artifact GC strategies at a glance Example real-world workflow lifecycle
  • Submit the workflow (for example via the Argo UI or kubectl). The produced artifact is stored in the configured artifact store (e.g., MinIO) under the workflow’s folder/bucket.
  • Inspect the artifact store to confirm artifact presence while the workflow exists or after completion.
  • Delete the workflow:
    • Artifacts with OnWorkflowDeletion will be removed by the garbage collector.
    • Artifacts with Never or OnWorkflowCompletion will follow their explicit artifact-level setting and may remain or be removed based on that configuration.
Best practices
  • Use workflow-level defaults to enforce cluster-wide conventions for ephemeral artifacts.
  • Override per-artifact when specific artifacts must be retained or cleaned up at a different time.
  • Monitor your artifact store capacity and configure lifecycle rules as needed in addition to Argo GC for long-term retention policies.
Links and references This concludes the demo article showing how to use Artifact Garbage Collection in Argo Workflows to manage artifact lifecycles and control storage usage.

Watch Video

Practice Lab