<p>I new in kube, and im trying to create deployment with configmap file. I have the following:</p>

<pre><code>app-mydeploy.yaml
--------
apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-mydeploy
  labels:
    app: app-mydeploy
spec:
  replicas: 3
  selector:
    matchLabels:
      app: mydeploy
  template:
    metadata:
      labels:
        app: mydeploy
    spec:
      containers:
        - name: mydeploy-1
          image: mydeploy:tag-latest
          envFrom:
          - configMapRef:
              name: map-mydeploy

map-mydeploy
-----
apiVersion: v1
kind: ConfigMap
metadata:
  name: map-mydeploy
  namespace: default
data:
  my_var: 10.240.12.1
</code></pre>

<p>I created the config and the deploy with the following commands:</p>

<pre><code>kubectl create -f app-mydeploy.yaml

kubectl create configmap map-mydeploy --from-file=map-mydeploy
</code></pre>

<p>when im doing <code>kubectl describe deployments</code>, im getting among the rest:</p>

<pre><code>Environment Variables from:
  map-mydeploy  ConfigMap  Optional: false
</code></pre>

<p>also <code>kubectl describe configmaps map-mydeploy</code> give me the right results.</p>

<p>the issue is that my container is <code>CrashLoopBackOff</code>, when I look at the logs, it says: time="2019-02-05T14:47:53Z" level=fatal msg="Required environment variable my_var is not set.</p>

<p>this log is from my container that says that the <code>my_var</code> is not defined in the env vars.</p>

<p>what im doing wrong?</p>

MIDE11
<p>I think you are missing you key in the command</p>

<p><code>kubectl create configmap map-mydeploy --from-file=map-mydeploy</code></p>

<ul>
<li>try to this <code>kubectl create configmap map-mydeploy --from-file=my_var=map-mydeploy</code></li>
</ul>

<p>also I highly recommend that if you are just using one value, create you configMap from literal <code>kubectl create configmap my-config --from-literal=my_var=10.240.12.1</code> then related the configMap in your deployment as you are currently doing it.</p>
