I am looking for some help/suggestions with kubernetes. I am trying to mount an NFS shared drive to the docker container running inside a kubernetes pod so that I can access the files inside that drive from code that runs inside the docker container. I was able to successfully mount the drive and I am able to see that based on the kubectl logs for the running pod.
But my problem is that only a service account has access to the contents of the folder I need to access and I am not sure how to use the service account to access the files. I am totally new to the the kubernetes world and trying to understand and learn how this kind of scenarios are handled. I used helm charts for configuring the NFS mount.
You should take a look at the Security Context. More specifically, fsGroup is used to define the Volume owner.
So generally mounting directly inside a Docker container is not the greatest solution.
What you should rather look at when mounting data, is to create a PersistentVolume and PersistentClaim in Kubernetes and mount that to the pod. This abstract Storage specifics from your application specifics.
You can find more information on the Kubernetes blog.
In here they explain about using NFS.