Skip to content

Instantly share code, notes, and snippets.

@hantoine
Forked from darpr/argo-in-kind.md
Last active July 11, 2022 13:44
Show Gist options
  • Save hantoine/2c5fc65ada9251d5780baf76a2dad668 to your computer and use it in GitHub Desktop.
Save hantoine/2c5fc65ada9251d5780baf76a2dad668 to your computer and use it in GitHub Desktop.
"Argo Workflow" in `kind` Cluster

Argo in Kind

Play with "Argo Workflow" in your local kind cluster.

Prerequisites

The following instructions were tested in macOS Monterey (12.4), on 10 Jul 2022.

Docker Runtime

Ensure docker is installed and running.

K8s Client

Install kubectl CLI if you haven't yet.

Kind Cluster

Configure kind before creating a cluster:

$ cat ~/.kube/kind-config.yaml
# 2 node (one masters & one worker) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    listenAddress: "0.0.0.0"
  - containerPort: 443
    hostPort: 443
    listenAddress: "0.0.0.0"

Create kind cluster:

$ kind create cluster --name argo --config ~/.kube/kind-config.yaml

Set KUBECONFIG:

$ export KUBECONFIG="$(kind get kubeconfig-path --name="argo")"

Verify:

$ kubectl cluster-info
Kubernetes master is running at https://127.0.0.1:58386
KubeDNS is running at https://127.0.0.1:58386/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
 
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Install Argo

Create Namespace:

$ kubectl create ns argo

In Argo, each Workflow Step is a K8s Pod. For Argo to create pods to execute the steps of a Workflow, we must create a Rolebinding to grant permission to Argo Workflow Controller to run Pods in default namespace:

$ kubectl create rolebinding default-admin --clusterrole=admin --serviceaccount=default:default

By default, Argo's Executor is docker. That doesn't work with kind clusters. Kind uses containerd, so let's configure Workflow Controller to use PNS (Process Namespace Sharing) executor:

$ kubectl create configmap -n argo workflow-controller-configmap --from-literal=config="containerRuntimeExecutor: pns"

Install Argo:

$ kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.3.8/install.yaml

Verify if all Images have been pulled and that Pods are running:

$ kubectl get pod -n argo
NAME                                   READY   STATUS      RESTARTS   AGE
argo-server-746f79f45d-wdm79           1/1     Running     0          69s
workflow-controller-69cbc6579f-jc2dv   1/1     Running     0          69s

Test Argo Workflow

Argo is a Kubernetes Custom Controller and Workflow CRD (extension of K8s API). This means that kubectl can be used to manage Workflows instead of Argo CLI:

$ kubectl create -f https://raw.githubusercontent.com/argoproj/argo/master/examples/coinflip.yaml

Port-forward:

$ kubectl port-forward -n argo svc/argo-server 8080:2746

Launch Argo UI at https://localhost:8080/.

References

  1. Kind for local Kubernetes - https://kind.sigs.k8s.io/
  2. Argo Quick Start - https://argoproj.github.io/argo/quick-start/
  3. Someone's solution in making Argo work in MicroK8s; use similar approach for kind clusters - argoproj/argo-workflows#2557
  4. https://boxboat.com/2020/02/10/argo-workflows/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment