This topic walks you through creating and running a hello-world workflow on your ACK cluster using Argo CLI.
Prerequisites
Before you begin, ensure that you have:
-
The Argo Workflows component installed and Alibaba Cloud Argo CLI configured. For setup instructions, see Enable batch task orchestration.
How it works
If you have ever run a container with Docker, an Argo workflow does the same thing—but on a Kubernetes cluster:
docker run mirrors-ssl.aliyuncs.com/busybox:latest echo "hello world"
An Argo workflow wraps that container run in a Kubernetes resource. Instead of a CLI command, you define the container, its command, and its arguments in a YAML file, then submit it to the cluster.
Create and run a workflow
Step 1: Define the workflow
Create a file named helloworld-workflow.yaml with 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" ]
Key fields:
| Field | Description |
|---|---|
kind: Workflow |
Declares this as an Argo workflow resource in Kubernetes. |
generateName |
Sets the name prefix. Kubernetes appends a random suffix, producing a unique name like hello-world-k8pz2 for each submission. |
entrypoint |
Specifies which template runs first. In a multi-step workflow, this is where execution begins. |
templates |
Defines the units of work. Each template can be a container, a script, or a sequence of steps. |
Step 2: Submit the workflow
Run the following command to submit the workflow to the argo namespace:
argo submit helloworld-workflow.yaml -n argo
Step 3: Check the workflow status
-
List all workflows in the namespace:
argo list -n argoThe output is similar to:
NAME STATUS AGE DURATION PRIORITY hello-world-XXXXX Succeeded 2m 37s 0A
Succeededstatus confirms the workflow completed. -
Get the full details of the workflow:
argo get hello-world-XXXXX -n argoThe output is similar to:
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: SucceededandCompleted: Trueconfirm the workflow ran to completion.
Argo CLI quick reference
| Operation | Command |
|---|---|
| Submit a workflow | argo submit <file>.yaml -n argo |
| List all workflows | argo list -n argo |
| Get details of a specific workflow | argo get <workflow-name> -n argo |
What's next
Workflow resources are periodically deleted from the cluster. To persist workflow records in a database, see Workflow persistence.