title: How to mount entire directory in Kubernetes using configmap?
body: <p>I want to be able to mount an unknown number of config files in /etc/configs</p>
  <p>I have added some files to the configmap using:</p>
  <blockquote>
  <p>kubectl create configmap etc-configs --from-file=/tmp/etc-config</p>
  </blockquote>
  <p>The number of files and file names are never going to be known and I would like to recreate the configmap and the folder in the Kubernetes container should be updated after sync interval.</p>
  <p>I have tried to mount this but I'm not able to do so, the folder is always empty but I have data in the configmap.</p>
  <pre><code>bofh$ kubectl describe configmap etc-configs
  Name:         etc-configs
  Namespace:    default
  Labels:       &lt;none&gt;
  Annotations:  &lt;none&gt;
  
  Data
  ====
  file1.conf:
  ----
  {
   ... trunkated ...
  }
  file2.conf:
  ----
  {
   ... trunkated ...
  }
  file3.conf:
  ----
  {
   ... trunkated ...
  }
  
  Events:  &lt;none&gt;
  </code></pre>
  <p>I'm using this one in the container volumeMounts:</p>
  <pre><code>- name: etc-configs
    mountPath: /etc/configs
  </code></pre>
  <p>And this is the volumes:</p>
  <pre><code>- name: etc-configs
    configMap:
      name: etc-configs
  </code></pre>
  <p>I can mount individual items but not an entire directory.</p>
  <p>Any suggestions about how to solve this?</p>