title: Mounting a hostPath persistent volume to an Argo Workflow task template
body: <p>I am working on a small proof-of-concept project for my company and would like to use Argo Workflows to automate some data engineering tasks. It's really easy to get set up and I've been able to create a number of workflows that process data that is stored in a Docker image or is retrieved from a REST API. However, to work with our sensitive data I would like to mount a hostPath persistent volume to one of my workflow tasks. When I follow the documentation I don't get the desired behavior, the directory appears empty.</p>
  <p>OS: Ubuntu 18.04.4 LTS<br />
  Kubernetes executor: Minikube v1.20.0<br />
  Kubernetes version: v1.20.2<br />
  Argo Workflows version: v3.1.0-rc4</p>
  <p>My persistent volume (claim) looks like this:</p>
  <pre><code>apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: argo-volume
    labels:
      type: local
  spec:
    storageClassName: manual
    capacity:
      storage: 10Gi
    accessModes:
      - ReadWriteOnce
    hostPath:
      path: &quot;/tmp/data&quot;
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: argo-hello
  spec:
    storageClassName: manual
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
  </code></pre>
  <p>and I run
  <code>kubectl -n argo apply -f pv.yaml</code></p>
  <p>My workflow looks as follows:</p>
  <pre><code>apiVersion: argoproj.io/v1alpha1
  kind: Workflow
  metadata:
    generateName: hello-world-volumes-
  spec:
    entrypoint: dag-template
    arguments:
      parameters:
      - name: file
        value: /mnt/vol/test.txt 
    volumes:
    - name: datadir
      persistentVolumeClaim:
        claimName: argo-hello
  
    templates:
    - name: dag-template
      inputs:
        parameters:
        - name: file
      dag:
        tasks:
        - name: readFile
          arguments: 
            parameters: [{name: path, value: &quot;{{inputs.parameters.file}}&quot;}]
          template: read-file-template
        - name: print-message
          template: helloargo
          arguments: 
            parameters: [{name: msg, value: &quot;{{tasks.readFile.outputs.result}}&quot;}] 
          dependencies: [readFile]   
    
    - name: helloargo
      inputs:
        parameters:
        - name: msg
      container:
        image: lambertsbennett/helloargo
        args: [&quot;-msg&quot;, &quot;{{inputs.parameters.msg}}&quot;]
    
    - name: read-file-template
      inputs:
        parameters:
        - name: path
      container:
        image: alpine:latest
        command: [sh, -c]
        args: [&quot;find /mnt/vol; ls -a /mnt/vol&quot;]
        volumeMounts:
        - name: datadir
          mountPath: /mnt/vol
  </code></pre>
  <p>When this workflow executes it just prints an empty directory even though I populated the host directory with files. Is there something I am fundamentally missing? Thanks for any help.</p>