Installing Argo Workflows on a Kubernetes cluster and running workflows
kubernetesArgo Workflows is an engine for executing workflows on Kubernetes.
Install CRDs, UI, and other components into the cluster.
$ ARGO_WORKFLOWS_VERSION="v3.5.12"
$ kubectl create namespace argo
$ kubectl apply -n argo -f "https://github.com/argoproj/argo-workflows/releases/download/${ARGO_WORKFLOWS_VERSION}/quick-start-minimal.yaml"
customresourcedefinition.apiextensions.k8s.io/clusterworkflowtemplates.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/cronworkflows.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/workflowartifactgctasks.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/workfloweventbindings.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/workflows.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/workflowtaskresults.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/workflowtasksets.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/workflowtemplates.argoproj.io created
serviceaccount/argo created
...
priorityclass.scheduling.k8s.io/workflow-controller created
deployment.apps/argo-server created
deployment.apps/workflow-controller created
deployment.apps/httpbin created
deployment.apps/minio created
Install Argo CLI.
$ wget "https://github.com/argoproj/argo-workflows/releases/download/v3.6.0-rc4/argo-darwin-amd64.gz"
$ gunzip "argo-darwin-amd64.gz"
$ chmod +x "argo-darwin-amd64"
$ mv "./argo-darwin-amd64" /usr/local/bin/argo
$ argo version
argo: v3.6.0-rc4
BuildDate: 2024-10-31T12:47:01Z
GitCommit: b26ed4aa4dee395844531efa4a76a022183bec22
GitTreeState: clean
GitTag: v3.6.0-rc4
GoVersion: go1.23.2
Compiler: gc
Platform: darwin/amd64
Workflows are defined using the Workflow resource for one-time execution, the WorkflowTemplate resource for multiple executions, and the CronWorkflow resource for scheduled executions. In addition to arranging steps like Step Functions, you can also describe a DAG with dependencies similar to Airflow.
CDKでStep Functionsによるワークフローを構築する - sambaiz-net
Run Apache Airflow with Docker Compose and execute a workflow - sambaiz-net
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
labels:
workflows.argoproj.io/archive-strategy: "false"
annotations:
workflows.argoproj.io/description: |
This is a simple hello world example.
spec:
entrypoint: hello-hello-hello
templates:
- name: hello-hello-hello
steps:
- - name: hello1
template: print-message
arguments:
parameters:
- name: message
value: "hello1"
- - name: hello2a
template: print-message
arguments:
parameters:
- name: message
value: "hello2a"
- name: hello2b
template: print-message
arguments:
parameters:
- name: message
value: "hello2b"
- name: print-message
inputs:
parameters:
- name: message
container:
image: busybox
command: [echo]
args: ["{{inputs.parameters.message}}"]
WorkflowTemplate’s templates can be reused using templateRef.
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: hello-world-template-global-arg
spec:
templates:
- name: hello-world
container:
image: busybox
command: [echo]
args: ["{{workflow.parameters.global-parameter}}"]
---
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-wf-global-arg-
spec:
entrypoint: print-message
arguments:
parameters:
- name: global-parameter
value: hello
templates:
- name: print-message
steps:
- - name: hello-world
templateRef:
name: hello-world-template-global-arg
template: hello-world
Submit it using argo submit.
$ argo submit -n argo test.yaml
# argo submit -n argo --from workflowtemplate/test-template
$ argo list -n argo
NAME STATUS AGE DURATION PRIORITY MESSAGE
hello-world-lxt42 Succeeded 1m 21s 0
From UI, you can view the workflow status and
$ kubectl -n argo port-forward service/argo-server 2746:2746
check the results for each task.