# Way 1: envFrom: all keys as env varsspec:containers:-name: app
envFrom:-configMapRef:name: app-config
# Way 2: env.valueFrom: single keyenv:-name: DATABASE_HOST
valueFrom:configMapKeyRef:name: app-config
key: DB_HOST
# Way 3: volume mount: keys become filesspec:volumes:-name: config-vol
configMap:name: app-config
containers:-name: app
volumeMounts:-name: config-vol
mountPath: /etc/config
# Way 3b: subPath: mount ONE key as a specific filevolumeMounts:-name: config-vol
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf # key name in ConfigMapreadOnly:true
Optional references
env:-name: FEATURE_FLAG
valueFrom:configMapKeyRef:name: feature-flags
key: enabled
optional:true# missing CM → env var omitted, Pod still startsvolumes:-name: config-vol
configMap:name: app-config
optional:true# missing CM → volume skipped
Without optional: true: missing ConfigMap → Pod stuck in CreateContainerConfigError