πŸ”§ DevOps

Argo Workflows

Argo Workflows

A Kubernetes-native workflow engine. Used for ML pipelines and CI/CD.

πŸ“– Detailed Explanation

Argo Workflows is a Kubernetes-native workflow engine that defines and runs complex job pipelines in the form of a DAG (Directed Acyclic Graph). Each task runs as a container, and it can make full use of Kubernetes' scalability and resource management features.

The main use cases are ML pipelines, data processing, and CI/CD. For example, in an ML workflow, the steps "data collection -> preprocessing -> model training -> evaluation -> deployment" each run as an independent container, and dependencies between steps and data passing are managed. If a step fails, only that step can be retried, or the workflow can be restarted from a specific step.

The core concepts of Argo Workflows are Workflow (the entire pipeline), Template (a reusable task definition), Step/DAG (task ordering definition), and Artifact (data passing between tasks). Artifacts are stored in object storage such as S3, GCS, and MinIO, and files are exchanged between workflow steps.

When used together with ArgoCD (GitOps deployment), Argo Events (event-based triggers), and Argo Rollouts (progressive delivery), which are also Argo projects, you can build a complete cloud-native CI/CD/ML platform. It is also used as the internal engine of Kubeflow Pipelines.

πŸ’» Code Example

# ml-pipeline.yaml - ML ν•™μŠ΅ νŒŒμ΄ν”„λΌμΈ μ›Œν¬ν”Œλ‘œμš°
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: ml-pipeline-
spec:
  entrypoint: ml-pipeline
  # Artifact μ €μž₯μ†Œ μ„€μ •
  artifactRepositoryRef:
    configMap: artifact-repositories
    key: default-v1

  # μ›Œν¬ν”Œλ‘œμš° μ „μ—­ νŒŒλΌλ―Έν„°
  arguments:
    parameters:
    - name: dataset-version
      value: "v2.1"
    - name: model-name
      value: "sentiment-classifier"

  templates:
  - name: ml-pipeline
    dag:
      tasks:
      # 1단계: 데이터 λ‹€μš΄λ‘œλ“œ
      - name: download-data
        template: download
        arguments:
          parameters:
          - name: version
            value: "{{workflow.parameters.dataset-version}}"

      # 2단계: μ „μ²˜λ¦¬ (download μ™„λ£Œ ν›„)
      - name: preprocess
        template: preprocess
        dependencies: [download-data]
        arguments:
          artifacts:
          - name: raw-data
            from: "{{tasks.download-data.outputs.artifacts.dataset}}"

      # 3단계: λͺ¨λΈ ν•™μŠ΅ (μ „μ²˜λ¦¬ μ™„λ£Œ ν›„)
      - name: train-model
        template: train
        dependencies: [preprocess]
        arguments:
          artifacts:
          - name: processed-data
            from: "{{tasks.preprocess.outputs.artifacts.processed}}"

      # 4단계: 평가
      - name: evaluate
        template: evaluate
        dependencies: [train-model]

  # κ°œλ³„ ν…œν”Œλ¦Ώ μ •μ˜
  - name: download
    inputs:
      parameters:
      - name: version
    container:
      image: myregistry/data-loader:latest
      command: [python, download.py]
      args: ["--version", "{{inputs.parameters.version}}"]
    outputs:
      artifacts:
      - name: dataset
        path: /data/output

  - name: train
    inputs:
      artifacts:
      - name: processed-data
        path: /data/input
    container:
      image: myregistry/ml-trainer:latest
      resources:
        requests:
          nvidia.com/gpu: 1
      command: [python, train.py]
    outputs:
      artifacts:
      - name: model
        path: /models/output

πŸ—£οΈ How It's Said in Practice

ML Engineer: "The training pipeline keeps failing at the preprocessing step. Did you check the logs in the Argo UI?"

Junior: "Yes, it was an OOM. I raised the resource request to 8Gi and it passed."

Senior: "Then you can resubmit the failed workflow and it will restart from preprocessing. Since the data download has an artifact, it will be skipped."

Interviewer: "Do you have experience with ML pipeline orchestration?"

Candidate: "I built a daily training pipeline using Argo Workflows. I defined everything from data collection to model deployment as a DAG, and set a nodeSelector so that it is scheduled on GPU nodes. I integrated it with Argo Events so that the pipeline is triggered automatically when new data is uploaded to S3."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

Reviewer: "Please add a retryStrategy to this workflow, so that it automatically retries if it fails due to a temporary network error."

Author: "I'll add retryStrategy: limit: 3, retryPolicy: Always. Should I add backoff as well?"

⚠️ Cautions

πŸ“š Learn More