Search code examples
kubernetesapache-nifinfskubernetes-statefulset

Mounting a shared folder to all state full set replicas in k8


Context :

We have a Apache Nifi cluster deployed in Kubernetes as Stateful sets, and a volume claim template is used for Nifi repositories.

Nifi helm charts we are using

There is a use case where file processing is done by Nifi. So the file feeds are put into a shared folder and nifi would read it from the shared folder. When multiple nodes of Nifi is present all three would read from the shared folder.

In a non kubernetes environment we use NFS file share.

In AWS we use AWS S3 for storage and Nifi has processors to read from S3.

Problem :

Nifi is already deployed as a statefulset and use volume claim template for the storage repository. How can we mount this NFS share for file feed to all nifi replicas.

or in other word putting the question in a generic manner,

How can we mount a single NFS shared folder to all statefulset replicas ?

Solutions tried

We tried to link separate pvc claimed folders to the nfs share , but looks like a work around.

Can somebody please help. Any hints would be highly appreciated.


Solution

  • Put it in the pod template like normal. NFS is a "ReadWriteMany" volume type so you can create one PVC and then use it on every pod simultaneously. You can also configure NFS volumes directly in the pod data but using a PVC is probably better.

    It sounds like what you have is correct :)