Play with "Argo Workflow" in your local kind
cluster.
The following instructions were tested in Ubuntu 22 April 2021
Ensure docker
is installed and running.
Install kubectl
CLI if you haven't yet.
Configure kind
before creating a cluster:
$ cat ~/.kube/kind-config.yaml
# 2 node (one masters & one worker) cluster config
kind: Cluster
apiVersion: kind.sigs.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'.
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://raw.githubusercontent.com/argoproj/argo-workflows/v3.0.2/manifests/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-58875f6969-s5fcw 1/1 Running 0 69s
workflow-controller-6b45888f5f-fh4ks 1/1 Running 0 69s
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-ui 8080:80
Launch Argo UI at http://localhost:8080/.
If you get the following error, make sure that you change Workflow Executor specific for kind
Clusters:
$ kubectl describe pod hello-world-vc727 -n argo
...
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 7m51s default-scheduler Successfully assigned argo/hello-world-vc727 to argo-worker
Warning FailedMount 98s (x11 over 7m50s) kubelet, argo-worker MountVolume.SetUp failed for volume "docker-sock" : hostPath type check failed: /var/run/docker.sock is not a socket file
Warning FailedMount 77s (x3 over 5m48s) kubelet, argo-worker Unable to mount volumes for pod "hello-world-vc727_argo(34a70316-afec-4754-8462-14b828e3cce5)": timeout expired waiting for volumes to attach or mount for pod "argo"/"hello-world-vc727". list of unmounted volumes=[docker-sock]. list of unattached volumes=[podmetadata docker-sock my-minio-cred default-token-xqwb5]
- Kind for local Kubernetes - https://kind.sigs.k8s.io/
- Argo Quick Start - https://argoproj.github.io/argo/quick-start/
- Someone's solution in making Argo work in MicroK8s; use similar approach for
kind
clusters - argoproj/argo-workflows#2557 - https://boxboat.com/2020/02/10/argo-workflows/