Share mount namespace with a privileged pod

3/13/2018

I am trying to get the mount point details of host from a kuberentes pod. It is a privileged container. Even if I mount the root file system , I am not able to check the mount details of a particular type say s3fsmay be because it belongs to a different namespace. What is the best way to share the mount point namespace.

-- ambikanair
kubernetes
mount
namespaces
s3fs

2 Answers

3/13/2018

If you really just want details of the host's mount points rather than access to them you can run your Pod with hostPID: true and then inspect the mounts of a process in the proc filesystem that you know is running in the host's mount namespace (for example PID 1) like so: cat /proc/1/mounts

-- dippynark
Source: StackOverflow

3/13/2018

I did some research and found that kubernetes provides an option called MountPropagation which helps to achieve my requirement.

I tested this feature in my local set up and it did give me the result I wanted.

Few links that I found useful:

https://medium.com/kokster/kubernetes-mount-propagation-5306c36a4a2d https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation

-- ambikanair
Source: StackOverflow