Argo Workflows is a Kubernetes-native workflow engine that orchestrates parallel tasks using YAML files or Python SDK, thus simplifying the automation and management of containerized applications. Argo Workflows is suitable for scenarios requiring multi-step processes, parallel tasks, and dependencies, such as data processing, machine learning pipelines, simulation computing, and Continuous Integration and Continuous Delivery (CICD) pipelines. This topic uses a sample application to demonstrate how to create a workflow using Argo CLI.
Prerequisites
The Argo Workflow component and Alibaba Cloud Argo CLI are installed. For more information, see Enable batch task orchestration.
Procedure
Use the following YAML template to create a file named helloworld-workflow.yaml. This file is used to submit a sample workflow task.
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" ]
Run the following command to 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 argo
Expected output:
NAME STATUS AGE DURATION PRIORITY hello-world-XXXXX Succeeded 2m 37s 0
This output indicates that the workflow is complete.
Run the following command to check the status of the workflow:
argo get hello-world-XXXXX -n argo
Expected 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 27s
This output also confirms that the workflow is complete.
Reference
Resources related to workflows are periodically deleted. To make them persistent in a database, see Workflow persistence.