title: Kube / create deployment with config map
body: <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>