<p>I'd like to create a cronjob that runs a python script mounted as a pvc, but I don't understand how to put test.py into the container from my local file system</p>
<pre><code>apiVersion: batch/v2alpha1
kind: CronJob
metadata:
name: update_db
spec:
schedule: &quot;*/1 * * * *&quot;
jobTemplate:
    spec:
    template:
        spec:
        containers:
        - name: update-fingerprints
          image: python:3.6.2-slim
          command: [&quot;/bin/bash&quot;]
          args: [&quot;-c&quot;, &quot;python /client/test.py&quot;]
          volumeMounts:
          - name: application-code
            mountPath: /where/ever
        restartPolicy: OnFailure
        volumes:
        - name: application-code
          persistentVolumeClaim:
          claimName: application-code-pv-claim
</code></pre>

<p>You have a volume called <code>application-code</code>. In there lies the <code>test.py</code> file. Now you mount the volume, but you are not setting the mountPath according to your shell command.</p>
<p>The argument is <code>pyhton /client/test.py</code>, so you expect the file to be placed in the <code>/client</code> directory. You just have to mount the volume with this path:</p>
<pre><code>volumeMounts:
- name: application-code
  mountPath: /client
</code></pre>
<p><strong>Update</strong></p>
<p>If you don't need the file outside the cluster it would be much easier to integrate it into your docker image. Here an example <code>Dockerfile</code>:</p>
<pre><code>FROM python:3.6.2-slim

WORKDIR /data

COPY test.py .

ENTRYPOINT['/bin/bash', '-c', 'python /data/test.py']
</code></pre>
<p>Push the image to your docker registry and reference it from your yml.</p>
<pre><code>containers:
        - name: update-fingerprints
          image: &lt;your-container-registry&gt;:&lt;image-name&gt;
</code></pre>
