Kubernetes with NFS storage as persistent Volume

Hi , We have deployed kubernetes with rancher. We have freenas which is used as our persistent storage. We have setup NFS(/mnt/tank/rancher-volume) on freenas .We use helm to deploy our applications. We are not able to deploy same applications into our cluster because data is directly getting written into /mnt/tank/rancher-volume and hence there is a conflict of data. Is it possible we can have k8s apps create separate directories inside our nfs volume for different apps.

Cluster information:

Kubernetes version:1.18.6
Cloud being used: (put bare-metal if not on a public cloud)
Installation method: Rancher
Host OS: RancherOS
CNI and version: canal
CRI and version: docker 19.03.11

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

2 thoughts here.

  1. you could try to modify the helm chart to create diff folders. shouldn’t be a problem
  2. you could use an nfs provider that you give it the necessary path to the freenas box. and then use PV objects to request storage.

i have freenas as my nfs storage, but i put my paths directly in the pod specs.

example:

volumes:
- name: pihole-etc
nfs:
server: “192.168.2.52”
path: “/mnt/vol/dataset1/Servers/kube/pihole/etc-pihole/”
readOnly: false
- name: pihole-dnsmasq
nfs:
server: “192.168.2.52”
path: “/mnt/vol/dataset1/Servers/kube/pihole/etc-dnsmasq.d/”
readOnly: false
- name: pihole-log
nfs:
server: “192.168.2.52”
path: “/mnt/vol/dataset1/Servers/kube/pihole/var-log/”
readOnly: false