CertGrid CertGrid
Hands-on Lab·Certified Kubernetes Administrator

ConfigMaps and Secrets

Four ways to hand configuration to a container, and the one difference that catches everyone: patch a ConfigMap and the mounted file updates while the environment variable does not. Also what "encoded" really means for a Secret, and what a missing key looks like.

Configuration and Secrets Guide 34 of 103 Beginner

Written against the versions above. Timestamps in the projected volume's directory names are generated per run. Everything else here is reproducible.

Any cluster does for this one. Run against the four-node lab.
Server NameIP AddressOSRolesCPURAMHDD
CKA1001192.168.0.175Ubuntu 26.04 LTSControl Plane Node2 Core4 GB50 GB
CKA1001-NODE01192.168.0.176Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE02192.168.0.177Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE03192.168.0.178Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

Before you start

  1. A ConfigMap is a map, and values can be files

  2. A Secret is a ConfigMap that is base64 and nothing more

  3. Four ways to consume them, in one Pod

  4. How a projected volume is actually built

  5. The asymmetry that causes incidents

  6. What a missing key looks like

  7. Clean up

Official sources