liveBook · Manning

Configmap volume

As explained in Kubernetes in Action, Second Edition

A ConfigMap volume is a Kubernetes volume that exposes data from a ConfigMap as files mounted in a container.

A ConfigMap volume exposes each entry in a Kubernetes ConfigMap as a file inside a container. It is especially useful for large or multiline configuration that is awkward to pass through environment variables. The same volume can be combined with environment-variable references when an application needs both forms. section 9.5.1 section 8.2.1

Mounting configuration files

Define a volume that references the ConfigMap, then mount it into the container. For example, a volume named envoy-config can reference kiada-ssl-config and expose its files under /etc/envoy. A process can then read files such as envoy.yaml or status-message. Use the items field when only selected ConfigMap entries should appear.

Account for these operational behaviors:

  • A missing, non-optional ConfigMap prevents the pod's volumes from being set up, so all containers remain unable to start. section 9.5.1
  • Mounting a volume over a directory hides files supplied by the container image, including subdirectories. Mount a single file with subPath when existing directory contents must remain visible. section 9.5.2
  • Kubernetes uses symbolic links so ConfigMap files can be updated atomically; inspect the mounted directory to see the versioned directory, ..data, and file links. section 9.5.2

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains manifests, selected entries, hidden directory contents, subPath, missing references, and atomic symbolic-link updates.
Examples
Uses an Envoy configuration pod, mounted envoy.yaml and status-message files, selected items, and kubectl inspection commands.
What it assumes
Assumes basic pods and containers while explaining ConfigMaps, volume mounts, file paths, and environment-variable alternatives.
What you can do after
Operate/configure pods with mounted ConfigMap files and diagnose startup, masking, selection, and update behavior.
How it connects
Connects ConfigMaps with Kubernetes volumes, environment variables, container filesystems, subPath, and symbolic links.

Also explained in

Compare how 2 books explain configmap volume →

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.