- workflow.spec.activeDeadlineSeconds — enforces a maximum runtime for the entire workflow (measured from creation). When exceeded, the Argo controller terminates the workflow.
- template-level activeDeadlineSeconds — enforces a maximum runtime for the pod that runs that template. When exceeded, Kubernetes terminates the pod.
activeDeadlineSeconds is measured in seconds. Template-level timeouts normally translate to the pod’s activeDeadlineSeconds and cause Kubernetes to terminate the pod when exceeded. The workflow-level timeout is enforced by the Argo controller and will terminate the whole workflow if it runs longer than the specified value.
How activeDeadlineSeconds works (quick overview)
- Workflow-level timeout:
- Enforced by the Argo controller.
- Kills the workflow once total runtime since creation exceeds the value.
- Template-level timeout:
- Enforced by Kubernetes for the pod running the template (via pod activeDeadlineSeconds).
- When a pod is terminated by Kubernetes for exceeding its deadline, that step/template is marked failed.
- Combined behavior:
- The earliest-exceeded deadline takes effect for a given pod/task.
- If any step fails (including due to timeout) the workflow will be marked failed unless you use retries, continueOn, or exit handlers.
Example Workflow YAML
Explanation of the example
- The workflow spec sets a total timeout of 60 seconds.
- The
maintemplate runs two sequential steps:quick-task(usesfast-step) andslow-task(usesslow-step). fast-stepsets activeDeadlineSeconds to 100 seconds, which is longer than the workflow-level 60s. Becausefast-stepitself only sleeps 2 seconds, it completes successfully before any timeout is reached.slow-stepsets activeDeadlineSeconds to 5 seconds but runssleep 30. Kubernetes will terminate the pod forslow-stepafter ~5 seconds with an event like: “Pod was active on the node longer than the specified deadline.” That step will be marked failed.- When a child step fails (for example due to pod termination for timeout), the workflow will typically be marked failed unless you configure retries, continueOn, or exit handlers to alter that behavior.
Quick reference table
| Resource | Purpose | Example |
|---|---|---|
| Workflow-level timeout | Bound the entire workflow runtime (enforced by Argo controller) | spec.activeDeadlineSeconds: 60 |
| Template-level timeout | Bound an individual template/pod runtime (enforced by Kubernetes) | templates[].activeDeadlineSeconds: 5 |
Important: activeDeadlineSeconds is an integer number of seconds. Template-level timeouts usually translate to the pod’s activeDeadlineSeconds and will be enforced by Kubernetes; the workflow-level timeout is enforced by the Argo controller. Ensure you pick values that reflect the longest acceptable runtime for each scope and test how retries or continueOn affect behavior.
Best practices
- Use workflow-level activeDeadlineSeconds to prevent runaway workflows and control resource consumption.
- Use template-level activeDeadlineSeconds for steps that you know can hang or take unpredictably long.
- Combine both levels to provide both per-step protection and an overall safety net.
- When using template-level timeouts, add logs or artifacts early in the template so failures due to timeouts are diagnosable.
- If a specific task is prone to transient failures, consider retries with backoff rather than only relying on deadlines.
Links and references
- Argo Workflows - Timeouts and Retries
- Kubernetes - Pod activeDeadlineSeconds
- Argo Workflows Documentation