Lab 01: Installation and Basics
Install Argo Workflows, submit a first workflow, learn the CLI.
Install
kubectl create namespace argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.7.9/install.yaml
kubectl get pods -n argo
kubectl get crd | grep argoproj
- installs
workflow-controller,argo-server, the CRDs (workflows,workflowtemplates,clusterworkflowtemplates,cronworkflows) and RBAC install.yamlis a cluster install (controller watches all namespaces)- pin whatever the latest release is: https://github.com/argoproj/argo-workflows/releases
CLI
brew install argo
argo version
- Linux: download
argo-linux-amd64.gzfrom the same release,gunzip,chmod +x, move to/usr/local/bin/argo
UI and auth
kubectl -n argo port-forward deployment/argo-server 2746:2746
- UI at
https://localhost:2746(self-signed cert) - default auth mode is
client, so the UI/CLI need a token. For the lab, switch the server to--auth-mode=server(uses the server’s own service account, no login, not for prod)
kubectl -n argo patch deployment argo-server --type=json \
-p='[{"op":"replace","path":"/spec/template/spec/containers/0/args","value":["server","--auth-mode=server"]}]'
kubectl -n argo rollout status deployment/argo-server
- restart the port-forward after the rollout
CLI against the port-forward:
export ARGO_SERVER=localhost:2746
export ARGO_SECURE=true
export ARGO_INSECURE_SKIP_VERIFY=true
export ARGO_NAMESPACE=argo
export ARGO_TOKEN="Bearer $(kubectl create token argo-server -n argo --duration=24h)"
- the token is only needed with the default
clientauth mode - alternatively unset
ARGO_SERVERand the CLI talks to the cluster directly via kubeconfig;kubectl createalways works
Hello world
hello-world.yaml:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
spec:
serviceAccountName: argo
entrypoint: main
templates:
- name: main
container:
image: alpine:3.20
command: [sh, -c]
args: ["echo 'Hello Argo Workflows!'"]
generateName= unique name per runentrypoint= template that runs firstserviceAccountName= SA the pod runs as. ThedefaultSA can’t createworkflowtaskresults, so the pod fails with RBAC errors. Better to create a dedicated SA with theexecutorrole (see lab 08)docker/whalesayis outdated (old manifest format), use alpine
kubectl create -n argo -f hello-world.yaml
argo submit -n argo hello-world.yaml --watch
argo list -n argo
argo get -n argo @latest
argo logs -n argo @latest
kubectl get wf -n argo -o yaml
kubectl create, notapply, because ofgenerateName@latest= most recent workflow- pod has two containers:
main(your code) andwait(executor, saves outputs/artifacts) - phase:
kubectl get wf -n argo <name> -o jsonpath='{.status.phase}'Pending,Running,Succeeded,Failed,Error
Parameters
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-param-
spec:
serviceAccountName: argo
entrypoint: main
arguments:
parameters:
- name: message
value: "Welcome to CAPA!"
templates:
- name: main
inputs:
parameters:
- name: message
container:
image: alpine:3.20
command: [sh, -c]
args: ["echo '{{inputs.parameters.message}}'"]
argo submit -n argo hello-param.yaml -p message="Hello from the CLI" --watch
-poverridesspec.arguments.parameters
Lifecycle commands
argo submit -n argo sleep.yaml # alpine: sleep 60
argo watch -n argo @latest
argo stop -n argo @latest
argo resubmit -n argo @latest
argo delete -n argo @latest
stoplets exit handlers run;terminatekills immediately- kubectl equivalent of stop:
kubectl patch wf -n argo <name> --type merge -p '{"spec":{"shutdown":"Stop"}}' - resource limits go on the container:
container:
image: alpine:3.20
resources:
requests: {cpu: 50m, memory: 64Mi}
limits: {cpu: 100m, memory: 128Mi}
Cleanup
argo delete -n argo --all
kubectl delete -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.7.9/install.yaml
kubectl delete namespace argo
- only remove the install if you are done with the labs
Next: Lab 02