In this blog, we will explore the features, benefits, and use cases of Argo Workflows, which can accelerate and streamline your application deployments, data pipelines, machine learning workflows, and more.
Table of Contents
What is Argo Workflows?
Argo Workflows is an open-source container-native workflow engine for orchestrating parallel jobs on Kubernetes. It is deployed as Kubernetes Custom Resource Definition (CRD). The users can define Argo Workflows using YAML manifests, making it easy to create, manage, and visualize workflows. It supports a range of features, including DAG (Directed Acyclic Graph) workflows, container-based tasks, workflow templates, and extensibility through hooks and plugins.
A simple Hello World example manifest:
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: whalesay
templates:
- name: whalesay
container:
image: docker/whalesay:latest
command: [cowsay]
args: ["hello world"]
Deploying Argo Workflows on a microk8s cluster
We will create ‘argo’ namespace and install the required CRDs.
kubectl create namespace argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.4.8/install.yaml
Let’s check what is deployed in the ‘argo’ namespace:
As the cluster is deployed on a remote VM, I’ll also expose the deployment ‘argo-server’ on Node Port so that it can be accessed remotely:
Use the existing argo-server Cluster IP Service to generate a template for the new service and edit it accordingly.
kubectl get svc argo-server -n argo -oyaml > argo-server-np.yaml
Let’s apply this manifest to create the Node Port service: argo-server-np
Argo Workflows UI
Let’s try to access the Argo Server Web UI using the newly created Node Port Service:
https://ipaddress:30085
I’m using 30085 port to access Web UI, you have to use the node port mentioned in the manifest above.
Argo Web Interface
How to create a token to log in to Argo Web UI?
We will create a service account, cluster role, and cluster role binding for this.
microk8s kubectl create clusterrole argowork --verb=list,update --resource=workflows.argoproj.io
microk8s kubectl create sa argowork -n argo
microk8s kubectl create clusterrolebinding argowork --clusterrole=argowork --serviceaccount=argo:argowork
Token creation:
microk8s kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: argowork.service-account-token
namespace: argo
annotations:
kubernetes.io/service-account.name: argowork
type: kubernetes.io/service-account-token
EOF
Retrieve the token value:
ARGO_TOKEN="Bearer $(microk8s kubectl get secret argowork.service-account-token -n argo -o=jsonpath='{.data.token}' | base64 --decode)"
Print the token value:
echo $ARGO_TOKEN
Now copy the token value and paste into the Web UI login field:
Click on the LOGIN button:
This is the landing page of the Argo Workflows Web UI.
How to install the Argo CLI binary?
# Download the binary
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.4.8/argo-linux-amd64.gz
# Unzip
gunzip argo-linux-amd64.gz
# Make binary executable
chmod +x argo-linux-amd64
# Move binary to path
mv ./argo-linux-amd64 /usr/local/bin/argo
# Test installation
argo version
argo cli version
Make sure Kubeconfig file is present in standard location or set the KUBECONFIG environment variable:
cd .kube/
microk8s config > config
Let’s submit our Hello Argo sample workflow:
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 argo example.
spec:
entrypoint: whalesay
templates:
- name: whalesay
container:
image: docker/whalesay:latest
command: [cowsay]
args: ["hello argo"]
hello-argo.yaml
Workflow has started:
Workflow is complete now:
Let’s check logs of the workflow we submitted using argo cli:
argo logs hello-world-xh57h -n argo
Status of the completed workflow on the Argo Web UI:
To get more details of the workflow just click on the workflow name:
Argo Workflow Examples
The example folder in the Argo Workflows git repository is a great place to see a wide variety of example manifest files to learn various concepts.
Argo Workflows Use cases
Some of the use cases where Argo Workflows is a great fit:
- Continuous Integration and Delivery (CI/CD) Pipelines: Automating the build, test, and deployment processes of applications.
- Data Processing and ETL Pipelines: Orchestrating data workflows for data ingestion, transformation, and analytics.
- Machine Learning Workflows: Managing end-to-end machine learning pipelines, including model training and inference.
- Event-Driven Workflows: Reacting to events and triggering workflows based on system events or external triggers.
- Infrastructure Provisioning and Management: Automating the provisioning and lifecycle management of infrastructure resources.
Conclusion
Argo Workflows provides a great piece of kit the Kubernetes users to automate and orchestrate their complex tasks and workflows, providing enhanced productivity, scalability, and reliability. By taking advantage of Argo Workflows, you can unlock the full potential of your Kubernetes cluster and streamline your application deployments, data processing pipelines, machine learning workflows, and more.
Please read our blog on Argo Workflows vs Kubernetes Job for more details on Argo.