CertGrid CertGrid
Hands-on Lab·Certified Kubernetes Application Developer

ConfigMaps: Environment Variables and Volume Mounts

There are three ways to create a ConfigMap and four ways to consume one, and CKAD tasks use all of them. This puts every consumption style into a single Pod so they can be compared in one log, then shows the failure a missing key produces - a status that is neither Running nor CrashLoopBackOff and that names the exact key it could not find.

Configuration and Security Guide 24 of 44 Beginner

Written against the versions above. `--from-env-file` reads `KEY=value` lines and makes one ConfigMap key per line; `--from-file` makes ONE key whose name is the filename and whose value is the whole file. Mixing those two up is the usual reason a mounted config file arrives as a directory of fragments or a single unusable blob.

Four short-lived Pods in one namespace. Nothing here depends on node placement.
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. Three ways to create one

  2. Four ways to consume one

  3. The key that is not there

  4. optional makes it tolerable

Official sources