How to make gcsfuse mounted path accessible by other container on same pod

containersgcsfusemount

Our goal is to use gcsfuse to mount a google bucket content to some path, and share this path with rest of the pod
So I tried to run our initContainer as privilege mode to run gcsfuse to mount bucket to our path1, inside of this initcontainer, I can see the content when doing ls -l that $path1

However, if I claim this path1 as the VolumnMounts and Volumn, other container cannot see the content under that path1

Unless I am following the example https://github.com/ageapps/k8s-storage-buckets/tree/master/gcsfuse-init to copy to some other folder and mount that folder as VolumnMount

But copying is not our preference, do we have a better way?

Best Answer

I am not running it in Kubernetes just straight up containers on a gcp vm. In order to see the mounts from the gcsfuse container, I needed to also run the second container with the --privileged --cap-add SYS_ADMIN options.

Also when launching my fuse container I shared the mount back to the host by adding this flag --device /dev/fuse -v /data:/data:shared.

Hopefully that will help you as there is not that much info about running gcsfuse in containers.

Related Topic