- Header: Kubernetes metadata (apiVersion, kind, metadata).
- spec: Describes workflow behavior and templates that perform work.
Workflow file structure
A typical workflow YAML contains the following top-level parts:- Header:
apiVersion,kind, andmetadata. - Metadata: you can specify
nameorgenerateName. UsegenerateNameto avoid collisions when submitting the same manifest multiple times — Argo appends a unique suffix. - spec: the core of the workflow. Important fields:
entrypoint: the name of the template that starts execution.templates: a list of reusable templates. Templates describe tasks and can reference each other.
Use generateName when you want to submit the same workflow multiple times without name collisions. Each submission will get a unique suffix appended to the provided generateName.
Template types (overview)
Templates are the building blocks of workflows. Argo supports several template types for different use cases:| Template Type | Use Case | Notes |
|---|---|---|
| container | Run a container image | Maps directly to a Kubernetes container spec (image, command, args, env, volumeMounts, resources) |
| script | Run inline scripts in various runtimes | Useful for quick logic without building a container image |
| steps | Define sequential steps | A list of templates executed in sequence |
| dag | Define directed acyclic graph execution | Supports complex dependency graphs and parallelism |
| resource | Create or modify Kubernetes resources | Useful for applying manifests or CRs as part of the workflow |
Container templates
Container templates accept the same fields as a Kubernetes Pod container spec. This means you can use:- image
- command and args
- env and envFrom
- volumeMounts and volumes
- resources
Submitting a workflow
You can submit workflows with either the Argo UI or the CLI. CLI example (submits to theargo namespace):
The
entrypoint must match one of the template names defined under templates. If it does not, the workflow will fail to start.Practical tips and best practices
- Use
generateNamefor recurring or CI-driven workflow submissions to avoid manual name management. - Keep templates small and reusable — compose complex workflows from simple building blocks (container/script/steps/dag).
- Use
resourcesandresourceLimitsto avoid noisy scheduling and to communicate expected resource usage. - Version control your workflow manifests alongside application code or infrastructure repositories for traceability.
Quick reference: spec fields
| Field | Description |
|---|---|
| entrypoint | Name of the template to execute first |
| templates | List of named templates used by the workflow |
| arguments | Pass parameters into templates and workflows |
| volumes | Shared volumes available to templates |
| serviceAccountName | Service account used by workflow pods |
Links and references
- Argo Workflows documentation
- Argo Workflows UI
- Argo CLI documentation
- Kubernetes CRDs
- Kubernetes Pod and container specs
- The
containersection within a template maps directly to a Kubernetes container spec and supportsenv,volumeMounts, andresources. - Always ensure the
entrypointvalue matches a defined template name undertemplates.