I'm am trying to set up a kubernetes service where multiple pods share the same directory on an NFS volume. The NFS volume has a bunch of data pre-generated outside kubernetes in a specific directory for the pods to both read & write.
I can think of two ways to try this, neither of which are working properly. The way we are currently doing it is by using the NFS option for creating a volume directly in the pod like this:
kind: Deployment
spec:
template:
spec:
containers:
...
volumes:
- name: embeddings
nfs:
path: /data/embeddings
server: fs-blahblah.efs.us-west-2.amazonaws.com
This mostly works. All the pods see the same directory on NFS, which is pre-populated with data, and they can all access it. But AFAIK that there is no way to specify NFS mount options. The only other allowed option is readonly. ref and we need to tune some things in the NFS client like noac.
The other way I can think of is to use a PersistentVolume. If you create a PV using NFS you can specify the mount options:
kind: PersistentVolume
spec:
mountOptions:
- nfsvers=4.1
- noac
But I don't know how to get a pod to access a specific directory within a PV. My understanding is this isn't possible - because pods can't mount PV's they can only mount PVC's, and AFAIK you can't pick a specific directory for a PVC, nor have multiple pods share a PVC which is what I specifically want. Plus the semantics for PVC just seem wrong - I don't want k8s to put storage limits on this drive, I want all the pods to use all the space on the disk they want/need. But maybe it can work anyway?
So, how can I get multiple pods to access the same specific directory on an NFS volume while specifying mountOptions?