<p>I have a Python code deployed as Knative-functions in which I would like to read a file saved in the local machine under the path '<strong>/app/uploads/file.csv</strong>'. The Knative cluster is deployed localy using <a href="https://knative.dev/docs/install/quickstart-install/" rel="nofollow noreferrer">Kind</a>. I would like to have read access of all the files inside '<strong>/app/uploads</strong>' folder.</p>
<p>What I have so far is:</p>
<ol>
<li>python code that attemps to read the file</li>
</ol>
<pre><code>    # (...)
    df = csv.read_csv(&quot;/app/uploads/file.csv&quot;)
    # (...)
</code></pre>
<ol start="2">
<li>func.yaml</li>
</ol>
<pre><code>
    specVersion: 0.35.0
    name: func-demo
    runtime: python
    registry: docker.io/&lt;user&gt;
    image: docker.io/&lt;user&gt;/func-demo:latest
    imageDigest: sha256:aa0b6e014726916253b2b37b83044a8d2b94b362b1087dcb189e2465e13663c6
    created: 2023-05-09T13:08:08.390261821+01:00
    build:
      buildpacks: []
      builder: pack
      buildEnvs: []
    run:
      volumes: []
      envs: []
    deploy:
      namespace: default
      remote: false
      annotations: {}
      options: {}
      labels: []
      healthEndpoints:
        liveness: /health/liveness
        readiness: /health/readiness
</code></pre>
<p>After deploying the python function to the knative local cluster and invoking it I get this error:</p>
<pre><code>Function raised [Errno 2] No such file or directory: '/app/uploads/file.csv'
</code></pre>
<hr />
<p>I also tried definning PersistentVolume and PersistentVolumeClaim in my cluster:</p>
<p>pv.yaml</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: uploads
  labels:
    type: local
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 1Gi
  hostPath:
    path: &quot;/app/uploads&quot;
</code></pre>
<p>pvc.yaml</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: uploads-claim
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: standard
  resources:
    requests:
      storage: 1Gi
</code></pre>
<p>and defined the previous func.yaml as:</p>
<pre><code>(...)
run:
  volumes:
    - persistentVolumeClaim:
        claimName: uploads-claim
      path: /app/uploads
(...)
</code></pre>
<p>but when I deploy the function I get this error:</p>
<pre><code>Error: 'func.yaml' contains errors:
        volume entry #0 is missing secret or configMap field, only path '/app/uploads' is set
</code></pre>

abdeltif-b
<p>You need to define mounts and volumes</p>
<p><a href="https://kind.sigs.k8s.io/docs/user/configuration/#extra-mounts" rel="nofollow noreferrer">https://kind.sigs.k8s.io/docs/user/configuration/#extra-mounts</a></p>
