LAB12: ConfigMap & Secret
1. CONFIGMAP — MULTIPLE SCENARIOS
A. Single Key-Value ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-single
data:
APP_MODE: "production"B. Multiple Key-Value Pairs
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-multi
data:
DB_HOST: "mysql"
DB_PORT: "3306"
FEATURE_FLAG: "true"C. YAML File Inside a ConfigMap
D. JSON File Inside a ConfigMap
E. Raw Text File
2. USING CONFIGMAPS IN PODS
A. Using configMapRef (envFrom)
B. Using valueFrom configMapKeyRef (only one key)
C. Mounting the ConfigMap as Files
D. Mounting Different Keys as Separate Files Using subPath
Full Pod Example Combining All Uses
3. BASIC SECRET EXAMPLES (Parallel Same Style)
A. Secret with single key
B. Secret with multiple keys
C. Secret file (YAML / JSON / text)
Mounting Secrets in Pods
A. Secret as environment variables
B. One key only
C. Secret as files
4. WHAT HAPPENS WHEN CONFIGMAP UPDATES?
A. If mounted as environment variables
B. If mounted as files (volume mount)
C. Deployments — How updates trigger rollout
Quick Summary Table
Use Case
Works with Env?
Auto-Update?
Works with Volume?
Notes
Last updated