Create a workflow
Argo Workflows is a Kubernetes-native workflow engine for orchestrating concurrent jobs. This tutorial walks you through submitting a sample workflow using the Argo CLI and verifying that it runs to completion.
In this tutorial, you will:
-
Define a workflow in YAML
-
Submit the workflow to your cluster
-
Verify that the workflow completes successfully
Prerequisites
Before you begin, ensure that you have:
-
Installed the Argo Workflows component and the Alibaba Cloud Argo CLI. See Enable batch job orchestration
Submit a workflow
-
Create a file named
helloworld-workflow.yamlwith the following content:apiVersion: argoproj.io/v1alpha1 kind: Workflow # Defines a new Kubernetes resource type for Argo Workflows. metadata: generateName: hello-world- # The prefix for the workflow name. Kubernetes will append a unique suffix. spec: entrypoint: main # Specifies the template to execute first. templates: - name: main # The name of the template. container: image: mirrors-ssl.aliyuncs.com/busybox:latest command: [ echo ] args: [ "hello world" ] -
Submit the workflow:
argo submit helloworld-workflow.yaml -n argo -
Check the status of the workflow.
-
Run the following command to get the list of workflows:
argo list -n argoExpected output:
NAME STATUS AGE DURATION PRIORITY hello-world-XXXXX Succeeded 2m 37s 0This output indicates that the workflow is complete.
-
Run the following command to check the status of the workflow:
argo get hello-world-XXXXX -n argoExpected output:
Name: hello-world-XXXXX Namespace: argo ServiceAccount: unset (will run with the default ServiceAccount) Status: Succeeded Conditions: PodRunning False Completed True .... Duration: 37 seconds Progress: 1/1 ResourcesDuration: 17s*(1 cpu),17s*(100Mi memory) STEP TEMPLATE PODNAME DURATION MESSAGE ✔ hello-world-XXXXX whalesay hello-world-XXXXX 27sStatus: Succeededconfirms the workflow completed without errors.
-
What's next
Workflow resources are periodically deleted. To persist workflow data to a database, see Persist workflows.