liveBook · Manning

Configmap

As explained in Learn Docker in a Month of Lunches, Second Edition

A ConfigMap is a Kubernetes API resource that stores non-sensitive configuration data as key-value pairs or text blocks.

A ConfigMap stores small configuration values as key-value pairs or text blocks. By itself it has no effect; a Pod specification must reference it to provide configuration to a container. section 15.4

Use ConfigMaps to deliver configuration in two practical forms:

  • Load keys such as DIAMOL_EDITION into container environment variables. section 15.4
  • Mount text blocks such as JSON, YAML, XML, or TOML as files in a container. section 15.4

Inspect injected configuration

Apply a Deployment that references the ConfigMap, inspect the resource with `kubectl describe configmap sleep-config-env`, then verify container variables with `kubectl exec deploy/sleep -- printenv`. For file-based configuration, list `/app/config` and print `config.json` from the container.

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Defines the resource and demonstrates both injection paths, while deferring broader configuration design and packaging.
Examples
Uses YAML manifests, kubectl inspection, environment-variable output, and a mounted JSON file.
What it assumes
Assumes basic Kubernetes Pods, Deployments, containers, and kubectl usage while demonstrating the configuration model incrementally.
What you can do after
Operate/configure containerized applications by injecting and verifying configuration with kubectl.
How it connects
Connects ConfigMaps with Pods, Deployments, containers, environment variables, mounted files, and Secrets.

Also explained in

Compare how 8 books explain configmap →

Related concepts

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