NFS server provisioner stable helm chart is widely used for deploying NFS servers on Kubernetes cluster. This server provides PVCs in RWM mode so that multiple web applications can access the data in a shared fashion. OpenEBS cStor volumes are used as persistent backend storage for these nfs servers to provide a scalable and manageable RWM shared storage solution.
Below are advantage of using NFS provisioner over OpenEBS cStor volumes
- NFS data is replicated, highly available across zones if configured accordingly
- Data is thin provisioned. Persistent volume mounts are configured at the required size and cStor physical pools can be started with as low as one disk per pool instance and grow as the storage is used up
Setting up a single NFS server
Select or create a cStor pool
Select or create a cStor pool that satisfies the performance, and availability requirements
Select or create a cStor storage Class
Create a storage class to point to the above selected pool and also select number of replicas and default size of the volume
Create a namespace for deploying NFS server provisioner
kubectl create ns <ns-nfs-wordpress1>
Deploy NFS server provisioner
Deploy NFS server provisioner into the above namespace using stable helm chart. Pass the following two main parameter values
- OpenEBS StorageClass to be used for the persistent data storage
- NFS StorageClass to be created which can be used by the web application PVCs
helm install stable/nfs-server-provisioner --name=<provisioner-name> --set=persistence.enabled=true,persistence.storageClass=openebs-cstor-sparse,persistence.size=5Gi,storageClass.name=<nfs-sc-name>
An example helm install command is
helm install stable/nfs-server-provisioner --name=openebs-nfs-wordpress --set=persistence.enabled=true,persistence.storageClass=openebs-sc-cstor-pool1,persistence.size=5Gi,storageClass.name=wordpress-nfs-sc1
Provision RWX volume using the PVC
Use the above storage class and create a new PVC and mount it inside the pod at a required mount point.
Setting up multiple NFS servers
When multiple NFS shares are needed, use multiple NFS provisioners. Each NFS server manages one NFS server. Same or different OpenEBS StorageClass can be used for multiple NFS provisioners.