Expose entire file-system of one container to another

Cluster information:

Kubernetes version: newest supported by Rancher
Cloud being used: variable
Installation method: Rancher
Host OS: variable
CNI and version: variable
CRI and version: variable

How can I expose an entire container’s file system to another container, just by using Kubernetes tools, not plain and direct Docker tools?

Not that I know of in any easy way. You could mount the host file system where all container filesystems are stored, but that exposes quite a bit more.

Ironically, I wanted to avoid mounting the host file system, therefore I wanted to check if the thought explained in the original post would be feasible. :laughing:

I actually only need a SMB share within a container exposed.

I’d like to:

  • Create a privileged container
  • mount an SMB share in it
  • letting the privileged container mount the SMB share on /smb
  • exposing /smb as a volume to the host file-system, i.e. /smb:/smb
  • mounting the volume in the non-privileged main container

Would this solution be feasible, instead?

O_o That seems like quite a bit to create a share – What are you trying to do? Is there a reason a regular pv/pvc wouldn’t work?

At our place, we try to avoid PVCs. It’s not something you can “hold in your hands”, to speak figuratively.