In this lesson you will create example Argo Workflows that demonstrate core concepts:
- Minimal container tasks
- Step-based pipelines (sequential and parallel)
- DAG-based dependencies
- Running kubectl inside workflows with RBAC considerations
Make sure you can run
argo version and kubectl get pods -n argo before starting. If Argo isn’t installed, see the official docs: Argo Workflows Installation.1) Minimal “Hello” workflow
Create a file namedhello-workflow.yaml with a single template that prints a message. Using generateName ensures each run receives a unique name.
generateNamelets Argo append random characters so each run is unique.entrypointpoints to the initial template (hello).- The
hellotemplate runs an Alpine container and executesecho.
2) Steps workflow — parameters, sequential and parallel steps
Steps are the simplest way to compose pipelines. In Argo:- A
stepstemplate contains an array of step-groups. - Each outer list item is a step-group (groups execute sequentially).
- Each step-group contains a list of steps that run in parallel.
print-message template that accepts a parameter, and a pipeline that runs two steps in sequence (each placed in separate step-groups).
print-messageaccepts a parametermessageand echoes it.- In
pipeline.steps, each outer-starts a step-group. Since each step-group above contains a single step, groups run sequentially. - To run both steps in parallel, place both step definitions in the same step-group (same outer list item), for example:
3) DAG workflows — expressing dependency graphs
When you need fine-grained dependency control, use a DAG (Directed Acyclic Graph). Each DAG task can declaredependencies. Tasks without dependencies start immediately; tasks that depend on others wait for their dependencies to complete. Tasks that share a dependency can run in parallel after that dependency finishes.
Example pipeline: build → (test-unit, test-integration) → deploy
buildruns first.- When
buildsucceeds, bothtest-unitandtest-integrationstart in parallel. - After both tests succeed,
deployruns.
4) Running kubectl in workflows (RBAC considerations)
Workflows execute inside Kubernetes pods. If a workflow must interact with the cluster (for example, runkubectl rollout status), the workflow pod needs proper credentials and RBAC permissions. Bind a dedicated service account to the workflow using serviceAccountName in the workflow spec.
Example workflow that runs kubectl rollout status and then lists pods in the argo namespace:
Never give workflows broad cluster-admin access in production. Create purpose-specific service accounts and grant only the RBAC permissions the workflow requires.
argo logs excerpt (abridged):
Quick reference
Summary
- Argo Workflows is for orchestrating container-based workflows on Kubernetes.
- Use
templateswithcontainertasks for individual jobs andinputs/parametersfor reusability. stepsenables simple sequential and parallel pipelines; outer groups run sequentially and inner lists run in parallel.dagenables expressive dependency graphs for complex orchestration.- When workflows interact with the cluster, use
serviceAccountNameand apply least-privilege RBAC.