dockerkubernetessambapersistent-volumes

Giving all containers in a Kubernetes service access to the same shared file system


New to Docker/K8s. I need to be able to mount all the containers (across all pods) on my K8s cluster to a shared file system, so that they can all read from and write to files on this shared file system. The file system needs to be something residing inside of -- or at the very least accessible to -- all containers in the K8s cluster.

As far as I can tell, I have two options:

  1. I'm guessing K8s offers some type of persistent, durable block/volume storage facility? Maybe PV or PVC?
  2. Maybe launch a Dockerized Samba container and give my others containers access to it somehow?

Does K8s offer this type of shared file system capability or do I need to do something like a Dockerized Samba?


Solution

  • NFS is a common solution to provide you the file sharing facilities. Here's a good explanation with example to begin with. Samba can be used if your file server is Windows based.