(Side note. This might not work for Docker for Mac users. I got an error saying “Not starting NFS kernel daemon: no support in current kernel.” You should be able to use Minikube instead.)

2. Use the NFS volume in the pod

This is the important part.

Here, we add the NFS volume to the pod. Set its server and path
values to point to the NFS server.

Then, mount the NFS volume in the container. In our example, we write
the date to the file in the network filesystem every five seconds.

(You’ll need to change the IP address in the YAML to the IP address
of the service we set up earlier. Theoretically you should be able
to use Kubernetes’ internal DNS resolution, but I couldn’t get that
to work.)

Create the pod with kubectl apply -f pod.yaml.

3. Check that it works

Now, check that the NFS volume works.

Sharing data between pods

You can use the NFS volume from the example above to share data between
pods in your cluster.

Just add the volume to each pod, and add a volume mount to use the
NFS volume from each container.