The article discusses how Kubernetes mountPropagation: HostToContainer leverages Linux namespaces to address the issue of agents being blind to new mounts created by Kubelet.
By default, each container in Kubernetes has its own isolated mount namespace, which causes the 'blind agent' problem when new mounts are not automatically reflected inside the container.
Kubernetes provides the mountPropagation field with modes like None, HostToContainer, and Bidirectional to control the sharing of mount events between the host and container's namespace.
To fix the blind agent issue, setting mountPropagation to HostToContainer allows the agent to see new PVs mounted by Kubelet without requiring a restart.
When mountPropagation is set to HostToContainer, any mount events occurring under the host path are automatically propagated into the container's mount namespace.
Considerations include security implications of Bidirectional mode and the need for appropriate privileges if the agent performs actions within the propagated mounts.
For troubleshooting, checking the mount table inside the container and comparing it to the host's can help identify issues related to mount propagation.
Understanding the HostToContainer mode (rslave) of mountPropagation is essential for agents needing visibility into dynamically created host mounts managed by Kubelet.
Kubernetes mountPropagation is a valuable tool that allows breaking container isolation selectively, enabling the creation of more robust and reliable agents and operators.
The article provides a detailed guide on using Kubernetes mountPropagation effectively to solve common agent visibility issues without resorting to restarting them.
The HostToContainer mode in mountPropagation plays a key role in addressing the challenge of agents needing to interact with dynamically created host mounts in Kubernetes clusters.