<p>We're creating a kubernetes statefulset that is mounting a pre-existing NFS share.</p>

<p>Here's a trimmed down example:</p>

<pre><code>apiVersion: apps/v1beta2
kind: StatefulSet
metadata: 
  name: hostname
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: container
        image: 4730230466298.dkr.ecr.us-east-1.amazonaws.com/container:latest
        volumeMounts:
        - name: efs
          mountPath: /efs
          readOnly: true
      volumes:
      - name: efs
        nfs:
          path: /
          server: 10.33.1.90
          readOnly: true
</code></pre>

<p>This works fine, and the nfs volume is correctly mounted into the container. But how can I specify the mount options on the the mount? I've tried setting the mountOptions parameter as shown here:
<a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options" rel="noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options</a></p>

<p>on the volume and the volumeMount and it fails to validate. I don't need (or want) to create a PV or PVC because the nfs volume already exists outside of k8s and I just need to use it. </p>

<p>Is there anyway to specify the mount options?</p>

<p>You are adding <code>PersistentVolumes</code>'s specs into <code>template.spec.volumes</code> (<code>Pos</code>'s volume).</p>

<p>These two are not the same thing. The correct reference for this <code>template.spec.volumes</code> would be <a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/volumes/</a></p>

<p>You can create a <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options" rel="nofollow noreferrer"><code>PersistentVolume</code></a> and <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims" rel="nofollow noreferrer"><code>persistenVolumeClaim</code></a> with proper <code>mountOptions</code>, then you can use that <code>pvc</code> in the volume field in your above yaml.</p>

<p>Here is some example of <a href="https://github.com/kubernetes/examples/tree/master/staging/volumes/nfs" rel="nofollow noreferrer"><code>nfs volume</code></a> given by kubernetes itself.</p>
