I have a question of injecting configmap to a pod in a definition yaml file In t . . .

Jay:
I have a question of injecting configmap to a pod in a definition yaml file
In the lecture I was told to do

...
spec:
  containers:
  ...
  envFrom:
    - configMapRef:
      name: app-config

But in the official document https://kubernetes.io/docs/concepts/configuration/configmap/

...
spec:
  containers:
    - name: demo
      image: alpine
      command: ["sleep", "3600"]
      env:
        # Define the environment variable
        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here
                                     # from the key name in the ConfigMap.
          valueFrom:
            configMapKeyRef:
              name: game-demo           # The ConfigMap this value comes from.
              key: player_initial_lives # The key to fetch.

Is there a difference between env and envFrom?

Paco Bernabé:
With “env” you can define your own variables and import specific ones from the configmap or a secret. With “envFrom” you take all the variables from a configmap or a secret.

Jay:
Oh i see, thanks for your reply :slight_smile: