liveBook · Manning

Mount point

As explained in Kubernetes in Action, Second Edition

VolumeMounts is the Kubernetes container field containing the volume mount definitions for that container.

A mount point is the path inside a container where a Pod volume becomes available. Kubernetes defines the volume separately in the Pod, then connects it to a container through that container’s volumeMounts array. This lets application files live in a volume instead of the container’s perishable filesystem. section 9.2.1

A volume mount definition normally specifies:

  • name: the volume name, which must match a volume defined in the Pod. section 9.2.1
  • mountPath: the path inside the container where Kubernetes mounts the volume. section 9.2.1
  • readOnly: whether the container receives a read-only mount; it defaults to false. section 9.2.1

Mounting an emptyDir volume

The Pod defines a volume named quiz-data, and the mongo container mounts that volume at /data/db. MongoDB therefore writes its files to the volume rather than the container filesystem. spec: volumes: - name: quiz-data emptyDir: {} containers: - name: mongo image: mongo volumeMounts: - name: quiz-data mountPath: /data/db section 9.2.1

Mounts can connect different containers to shared data at different paths. An init container can write files to a mounted volume, after which a main container reads them. Secret volumes use the same pattern; for example, certificate files can be mounted read-only at /etc/certs. section 9.2.2 section 9.5.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines required name and mountPath fields, common read-only behavior, and lifecycle interaction with init containers.
Examples
Uses MongoDB data at /data/db, initialized files at /docker-entrypoint-initdb.d/, and TLS files at /etc/certs.
What it assumes
Assumes familiarity with basic Pod manifests while introducing the relationship between Pod volumes and container filesystems.
What you can do after
Configure volume-backed container paths in Pod manifests and distinguish volume definitions from their container mounts.
How it connects
Relates volumes, containers, Pods, init containers, emptyDir volumes, and Secret volumes.

Also explained in

Compare how 2 books explain mount point →

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.