Configmap from-env-file environment variables

Nagesh Jayaram:
@Rahul Soni
Here is my ConfigMap defined from file,

k describe cm app-config 
Name:         app-config
Namespace:    default
Labels:       <none>
Annotations:  <none>

Data
====
config.txt:
----
App_Name=FlaskApp
App_User=finance_user
App_Password=SecretPassword
App_Group=Finance

I wanted to use these as Environment Variables, So I used envfrom as shown below, But it is not listing them as Env Variables , when I exec with Shell and tested with Env

  1 apiVersion: v1
  2 kind: Pod
  3 metadata:
  4   creationTimestamp: null
  5   labels:
  6     run: app-pod
  7   name: app-pod
  8 spec:
  9   containers:
 10   - image: nginx
 11     name: app-pod
 12     envFrom:
 13     - configMapRef:
 14        name: app-config

Nagesh Jayaram:
Any specific reason why it is not loading them as Env Variables
Also when I describe this Pod, it shows as Optional

Nagesh Jayaram:
@Rahul Soni this is what I have asked 2 days back also

Dennis Jacob:
Looking at the output of “k describe cm app-config”, it looks like you might have created the cm using --from-file instead of --from-env-file option. Can you try create using the --from-env-file option with cm?

Nagesh Jayaram:
huum may be, I will re-check, How I created the configMap, It was created many days back …
I believe there is no way to get how the configMap was created…

Dennis Jacob:

Name:         mycm2
Namespace:    my-ns
Labels:       <none>
Annotations:  <none>

Data
====
App_Group:
----
Finance
App_Name:
----
FlaskApp
App_Password:
----
SecretPassword
App_User:
----
finance_user

Dennis Jacob:
Above is a format how it looks like, if it was created with --from-env-file

Rahul Soni:
https://kodekloud.slack.com/archives/CHMV3P9NV/p1588825299205800|https://kodekloud.slack.com/archives/CHMV3P9NV/p1588825299205800