title: How can I do a docker -v in Kubernetes persistent volumes?
body: <p>I've successfully managed to create an NFS Persistent Volume and a Persistent Volume claim which when I run my deployment does what it's supposed to and mounts my apps data folder on the NFS volume. All good.</p>
  <p>In docker there is the ability to run</p>
  <pre><code>-v &lt;host dir&gt;:&lt;container dir&gt;
  </code></pre>
  <p>How do I tell Kubernetes in my deployment not to use /kubernetes but to use /kubernetes/ for example?</p>
  <p>The current working code is:
  nfs-pv.yaml</p>
  <pre><code>apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: nfs-pv
  spec:
    capacity:
      storage: 10Gi
    volumeMode: Filesystem
    accessModes:
      - ReadWriteMany
    persistentVolumeReclaimPolicy: Recycle
    storageClassName: nfs
    mountOptions:
      - hard
    nfs:
      path: /Dev1Partition1/kubernetes
      server: 192.168.40.202
  </code></pre>
  <p>nfs-pvc.yaml</p>
  <pre><code>apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: nfs-pvc
  spec:
    storageClassName: nfs
    accessModes:
      - ReadWriteMany
    resources:
      requests:
        storage: 1Gi
  </code></pre>
  <p>The above works when I run the following deployment the data I expect appears in the Kubernetes folder I specified.</p>
  <p>The Deployment looks like this
  deployment.yaml</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    labels:
      run: n8n-server
    name: n8n-deployment
  spec:
    replicas: 1
    selector:
      matchLabels:
        run: n8n-deployment
    template:
      metadata:
        labels:
          run: n8n-deployment
      spec:
        volumes:
          - name: n8n-pv-storage
            persistentVolumeClaim:
              claimName: nfs-pvc
        containers:
        - image: 192.168.40.43:8081/dockercontainers/library/n8n:latest
          name: n8n-server
          volumeMounts:
            - mountPath: &quot;/root/.n8n&quot;
              name: n8n-pv-storage
        imagePullSecrets:
          - name: progercred
  </code></pre>
  <p>I tried adding under volumes:</p>
  <pre><code>hostPath: path: n8n (and /n8n) 
  type: Directory
  </code></pre>
  <p>This throws up</p>
  <blockquote>
  <p>spec.template.spec.volumes[0].persistentVolumeClaim: Forbidden: may
  not specify more than 1 volume type</p>
  </blockquote>
  <blockquote>
  <p>spec.template.spec.containers[0].volumeMounts[0].name: Not found:
  &quot;n8n-pv-storage&quot;</p>
  </blockquote>
  <p>I'm guessing because hostPath is for emptyDir?</p>
  <p>Help?</p>
  <p>Am i thinking about this right?</p>