Skip to content

Instantly share code, notes, and snippets.

@SerRichard
Last active July 14, 2025 10:13
Show Gist options
  • Select an option

  • Save SerRichard/570b8dc35aa27748853541e942b6c540 to your computer and use it in GitHub Desktop.

Select an option

Save SerRichard/570b8dc35aa27748853541e942b6c540 to your computer and use it in GitHub Desktop.
A number of examples for consuming storage in Argo Workflows

Using the NFS

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: volumes-nfs-
spec:
  entrypoint: volumes-pvc-example
  securityContext:
    runAsUser: 1000
    fsGroup: 71559
  volumes:
  - name: eodc-mount
    persistentVolumeClaim:
      claimName: eodc-nfs-claim

  templates:
  - name: volumes-pvc-example
    steps:
    - - name: generate
        template: hello-world-to-file
    - - name: print
        template: print-message-from-file

  - name: hello-world-to-file
    container:
      image: busybox
      command: [sh, -c]
      args: ["echo generating message in volume; echo hello world | tee /eodc/private/openeo/workshop/hello_world.txt"]
      volumeMounts:
      - name: eodc-mount
        mountPath: /eodc

  - name: print-message-from-file
    container:
      image: alpine:latest
      command: [sh, -c]
      args: ["echo getting message from volume; cat /eodc/private/openeo/workshop/hello_world.txt"]
      volumeMounts:
      - name: eodc-mount
        mountPath: /eodc

Using OpenStack via the Cinder CSI

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: volumes-pvc-
spec:
  entrypoint: volumes-pvc-example
  volumeClaimTemplates:
  - metadata:
      name: workdir
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
      storageClassName: cinder

  templates:
  - name: volumes-pvc-example
    steps:
    - - name: generate
        template: hello-world-to-file
    - - name: print
        template: print-message-from-file

  - name: hello-world-to-file
    container:
      image: busybox
      command: [sh, -c]
      args: ["echo generating message in volume; echo hello world | tee /mnt/vol/hello_world.txt"]
      volumeMounts:
      - name: workdir
        mountPath: /mnt/vol

  - name: print-message-from-file
    container:
      image: alpine:latest
      command: [sh, -c]
      args: ["echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txt"]
      volumeMounts:
      - name: workdir
        mountPath: /mnt/vol

Using the artifact repository

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: artifact-repository-ref-
spec:
  entrypoint: main
  templates:
    - name: main
      container:
        image: busybox
        command: [ sh, -c ]
        args: [ "echo hello world > /tmp/hello_world.txt && ls -l /tmp && cat /tmp/hello_world.txt" ]
      outputs:
        artifacts:
          - name: hello_world
            path: /tmp/hello_world.txt

Using the EmptyDir

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: volumes-emptydir-
spec:
  entrypoint: volumes-pvc-example
  volumes:
  - name: workdir
    emptyDir: {}

  templates:
  - name: volumes-pvc-example
    steps:
    - - name: generate
        template: hello-world-to-file
    - - name: print
        template: print-message-from-file

  - name: hello-world-to-file
    container:
      image: busybox
      command: ["sh", "-c"]
      args:
        - |
          echo "Hello from step 1" > /mnt/vol/message.txt
      volumeMounts:
      - name: workdir
        mountPath: /mnt/vol

  - name: print-message-from-file
    container:
      image: alpine:latest
      command: ["sh", "-c"]
      args:
        - |
          if [[ -f /mnt/vol/message.txt ]]; then
            echo "File contents:"
            cat /mnt/vol/message.txt
          else
            echo "File not found!"
          fi
      volumeMounts:
      - name: workdir
        mountPath: /mnt/vol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment