<p>I have the documentation regarding the configmap:</p>

<pre><code>https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#define-container-environment-variables-using-configmap-data
</code></pre>

<p>From what I understand is I can create a config map(game-config-2) from two files
(game.properties and ui.properties) using </p>

<pre><code>kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/kubectl/game.properties --from-file=configure-pod-container/configmap/kubectl/ui.properties
</code></pre>

<p>Now I see the configmap </p>

<pre><code>kubectl describe configmaps game-config-2
Name:           game-config-2
Namespace:      default
Labels:         &lt;none&gt;
Annotations:    &lt;none&gt;

Data
====
game.properties:        158 bytes
ui.properties:          83 bytes
</code></pre>

<p>How can I use that configmap? I tried this way:</p>

<pre><code>    envFrom:
    - configMapRef:
        name: game-config-2
</code></pre>

<p>But this is not working, the env variable is not picking from the configmap. Or can I have two configMapRef under envFrom?</p>

Vikas Rathore
<p>Yes, a pod or deployment can get env From a bunch of configMapRef entries:</p>
<pre><code>    spec:
      containers:
      - name: encouragement-api
        image: registry-......../....../encouragement.api
        ports:
        - containerPort: 80
        envFrom:
          - configMapRef:
              name: general-config
          - configMapRef:
              name: private-config
</code></pre>
<p>Best to create them from yaml files for k8s law and order:</p>
<p>config_general.yaml</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: general-config
data:
  HOSTNAME: Develop_hostname
  COMPUTERNAME: Develop_compname
  ASPNETCORE_ENVIRONMENT: Development
</code></pre>
<p>encouragement-api/config_private.yaml:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: private-config
data:
  PRIVATE_STUFF: real_private
</code></pre>
<p>apply the two configmaps:</p>
<pre><code>kubectl apply -f config_general.yaml
kubectl apply -f encouragement-api/config_private.yaml
</code></pre>
<p>Run and exec into the pod and run <code>env |grep PRIVATE &amp;&amp; env |grep HOSTNAME</code></p>
<p>I have config_general.yaml laying around in the same repo as the developers' code, they can change it however they like. Passwords and sensitive values are kept in the config_private.yaml file which is sitting elsewhere (a S3 encrypted bucket) and the values there are base64 encoded for an extra bit of security.</p>
