title: Why does Kubernetes report: "configmap references non-existent config key"?
body: <p>In Kubernetes I create a configmap using:</p>
  
  <p><code>kubectl create configmap dd-agent-config --from-file=./kubernetes/datadog/configmap.yaml</code></p>
  
  <p>configmap.yaml:</p>
  
  <pre><code>kind: ConfigMap
  apiVersion: v1
  metadata:
    name: dd-agent-config
    namespace: default
  data:
    etcd: |-
      ad_identifiers:
        - etcd
      init_config:
      instances:
        - prometheus_url: "http://%%host%%:2379/metrics"
          ssl_cert: "/etc/kubernetes/pki/etcd/peer.crt"
          ssl_private_key: "/etc/kubernetes/pki/etcd/peer.key"
          ssl_ca_cert: "/etc/kubernetes/pki/etcd/ca.crt"
  </code></pre>
  
  <p>The description of the configmap loaded in Kubernetes:</p>
  
  <pre><code>$ kubectl describe configmap dd-agent-config               
  Name:         dd-agent-config
  Namespace:    default
  Labels:       &lt;none&gt;
  Annotations:  &lt;none&gt;
  
  Data
  ====
  configmap.yaml:
  ----
  kind: ConfigMap
  apiVersion: v1
  metadata:
    name: dd-agent-config
    namespace: default
  data:
    etcd: |-
      ad_identifiers:
        - etcd
      init_config:
      instances:
        - prometheus_url: "http://%%host%%:2379/metrics"
          ssl_cert: "/etc/kubernetes/pki/etcd/peer.crt"
          ssl_private_key: "/etc/kubernetes/pki/etcd/peer.key"
          ssl_ca_cert: "/etc/kubernetes/pki/etcd/ca.crt"
  Events:  &lt;none&gt;
  </code></pre>
  
  <p>My pod definition:</p>
  
  <pre><code>apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    name: datadog-agent
  spec:
    selector:
      matchLabels:
        app: datadog-agent
    template:
      metadata:
        labels:
          app: datadog-agent
        name: datadog-agent
      spec:
        serviceAccountName: datadog-agent
        containers:
          - image: datadog/agent:7
            name: datadog-agent
            [...]
            volumeMounts:
              - name: confd-config
                mountPath: /conf.d/etcd.d
        volumes:
          - name: confd-config
            configMap:
              name: dd-agent-config
              items:
                - key: etcd
                  path: auto_conf.yaml
  </code></pre>
  
  <p>Somehow this pod is unable to see the configmap key 'etcd':</p>
  
  <pre><code>$ kubectl get events 
  0s          Warning   FailedMount         pod/datadog-agent-t56lp                       MountVolume.SetUp failed for volume "confd-config" : configmap references non-existent config key: etcd
  </code></pre>
  
  <p>and the pod stays in the state of "ContainerCreating"</p>
  
  <pre><code>$ kubectl get pods
  NAMESPACE     NAME                                     READY   STATUS              RESTARTS   AGE
  default       datadog-agent-t56lp                      0/1     ContainerCreating   0          64s
  </code></pre>