According to the Kubernetes docs K8s Docs as of v1.6 and later we are able to use:
envFrom:
- configMapRef:
name: <config-file>
To define all the configMaps data as container env variables. What is the use case for using this versus setting it as an env variable with the name and key:
env:
# Define the environment variable
- name: SPECIAL_LEVEL_KEY
valueFrom:
configMapKeyRef:
# The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY
name: special-config
# Specify the key associated with the value
key: special.how
Would you use the second example if you had multiple variables in the file but only wanted to pull out a single key=value pair? I am trying to understand different use cases for scenarios I may encounter on the CKAD exam.