Using existing NFS shares in pods

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.17.5
Cloud being used: baremetal
Installation method: RKE (Rancher)
Host OS: CentOS 7
CNI and version: canal
CRI and version:

Just wanting to know how people are using existing NFS shares already populated with data in their pods. Are you mounting directly or using PVs? If directly, are you having problems with lack of mount option support in direct volume mounts? If PVs, how are you dealing with the situation where the PVC is deleted and the PV goes into “released” state?

Thanks.

do you mean nfs shares on a nas or something external to the the cluster?

Yes, exactly. We use shares from our NetApps extensively, and are in the process of containerising apps.

I use PVC’s and PVs for this, and it works well. When the PVC is deleted along with its PV, that does not cause the external share to be deleted if that’s your concern with the “released” state comment. Or at least I have never seen that happen–that would be horrifying.

My big concern with nfs volumes I raised here: https://github.com/kubernetes/kubernetes/issues/93802

To me that seems like a critical mistake, but it doesn’t seem like the community agrees-- or at least they haven’t gotten very interested in it. So, I’m not sure if I’m missing something, but I’ll probably make one last attempt on that issue to understand why it’s not considered a critical issue.

I wasn’t worried about the share being wiped but more about an administrative problem where we’re having to recreate PVs all the time. Maybe that just doesn’t happen to an appreciable degree. Thanks for the endorsement for using PVs for this.

Ohh you are right that that is fairly annoying. I wrote a helm chart that creates nfs and cifs pv,pvc pairs for teams in their namespaces. It has been smooth, but you are right that it’s annoying if you ever have to recreate a pv,pvc pair: since the pv names are immutable sometimes you need to slightly adjust the name rather than wait for the previous one to finish terminating.