liveBook · Manning

Mount namespace

As explained in Kubernetes in Action, Second Edition

A mount namespace is a Linux namespace that isolates the filesystem mount points visible to processes.

A mount namespace isolates the filesystem mount points visible to a process. It gives each container its own view of the filesystem, so processes in different containers do not automatically see the same mounted filesystems. section 2.3.1

Linux organizes resources into namespaces, or smaller visibility buckets. A process belongs to a namespace for each resource type, including mount points, process IDs, network interfaces, and user IDs. The mount namespace is the resource-specific boundary for filesystems. section 2.3.1

Two containers sharing selected files

Two containers in the same pod still use separate mount namespaces. If both need access to part of the same filesystem, a volume can be added to the pod and mounted into both containers. The volume is shared even though the mount namespaces remain separate. section 5.1.1

This boundary differs from namespaces that a pod may share. Containers can share network, IPC, or UTS namespaces, and a pod can optionally use one PID namespace; each container nevertheless retains its own mount namespace. section 5.1.1

Figure 2.17 Each process is associated with multiple namespace types, some of which can be shared.
figure

Use the namespace overview to compare mount isolation with the other namespace types associated with a process. section 2.3.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines filesystem isolation and contrasts separate mount namespaces with shared volumes, without detailing kernel implementation.
Examples
Uses containers in one pod with separate mount namespaces and a volume mounted into both.
What you can do after
Evaluate container filesystem visibility and recognize when a pod volume is needed for sharing files.
How it connects
Connects mount namespaces with containers, pods, volumes, and Linux kernel namespaces.

Also explained in

Compare how 2 books explain mount namespace →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.