Argo Workflows is a Kubernetes-native workflow engine. It allows you to use YAML or Python to orchestrate concurrent jobs in order to simplify the automation and management of containerized applications. Argo Workflows is suitable for handling multiple steps, concurrent jobs, and dependencies, such as data processing, machine learning pipelines, simulation computing, and CI/CD pipelines. This topic describes how to use the Argo CLI to create a workflow.
Prerequisites
Refer to Enable batch job orchestration to install the component and Alibaba Cloud Argo CLI.
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.
References
Resources used by workflows are periodically deleted. To persist workflows to databases, see Persist workflows.