<p>I am trying to deploy my image to Azure Kubernetes Service. I use command:</p>
<pre><code>kubectl apply -f mydeployment.yml
</code></pre>
<p>And here is my deployment file:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-api
  template:
    metadata:
      labels:
        app: my-api
    spec:
      containers:
      - name: my-api
        image: mycr.azurecr.io/my-api
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
        ports:
        - containerPort: 80
        envFrom:
          - configMapRef:
              name: my-existing-config-map
</code></pre>
<p>I have configmap <code>my-existing-config-map</code> created with a bunch of values in it but the deployment doesn't add these values as environment variables.</p>
<p>Config map was created from &quot;.env&quot; file this way:</p>
<pre><code>kubectl create configmap my-existing-config-map --from-file=.env
</code></pre>
<p>What am I missing here?</p>

Andrei
<p>If your .env file in this format</p>
<pre><code>a=b
c=d
</code></pre>
<p>you need to use --from-<strong>env</strong>-file=.env instead.</p>
<p>To be more explanatory, using --from-file=aa.xx creates configmap looks like this</p>
<pre><code>aa.xx: |
  file content here....
  ....
  ....
</code></pre>
<p>When the config map used with envFrom.configmapref, it just creates on env variable &quot;aa.xx&quot; with the content. In the case, that filename starts with '.' like .env , the env variable is not even created because the name violates UNIX env variable name rules.</p>
