1. ConfigMap object
A ConfigMap stores non-secret key/value config separate from the container image.
kind: ConfigMapTyporithm · easy
Step 1 of 8 · intro card
Config & Scaling
A ConfigMap holds non-secret key/value config; envFrom.configMapRef injects every key as an env var, decoupling configuration from the image.
A ConfigMap externalizes configuration so the same image can run across environments by swapping the ConfigMap, not rebuilding.
The data block stores plain string key/value pairs; pods read them as environment variables or mounted files.
envFrom.configMapRef injects all keys at once, while env.valueFrom.configMapKeyRef pulls a single key by name.
data holds plain string key/value pairs.
envFrom.configMapRef injects every key.
configMapKeyRef pulls one specific key.
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
LOG_LEVEL: "info"
APP_MODE: "production"
---
apiVersion: v1
kind: Pod
metadata:
name: web
spec:
containers:
- name: web
image: nginx:1.27
envFrom:
- configMapRef:
name: app-configConnect each part of the code to the concept before you type.
A ConfigMap stores non-secret key/value config separate from the container image.
kind: ConfigMapThe data block holds plain string key/value pairs the app reads at runtime.
data:
LOG_LEVEL: "info"
APP_MODE: "production"envFrom.configMapRef injects every key in the ConfigMap as an environment variable.
envFrom:
- configMapRef:
name: app-configRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.