<p>I am unable to mount a configmap using multi-folder volume mount.</p>

<p>The structure of my <code>volume-mount.yaml</code> is below:</p>

<p><strong>DOESN'T WORK</strong></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-web
spec:
  containers:
    - name: test-web
      image: docker.io/hello-world    
      volumeMounts:
      - name: config-volume
        mountPath: /usr/test
  volumes:
    - name: config-volume
      configMap:
        name: test-config-map
        items:
       - key: application.properties 
         path: test-web
       - key: test.xml
          path: test-web/configs/test_config
  restartPolicy: Never
</code></pre>

<p><strong>Error</strong>:</p>

<pre><code>MountVolume.SetUp failed for volume "config-volume" : open /var/lib/kubelet/pods/93768c34-6dc6-11e8-9546-025000000001/volumes/kubernetes.io~configmap/config-volume/..2018_06_11_22_27_08.476420050/test-web: is a directory`
</code></pre>

<p><strong>WORKS</strong></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-web
spec:
  containers:
    - name: test-web
      image: docker.io/hello-world    
      volumeMounts:
      - name: config-volume
        mountPath: /usr/test
  volumes:
    - name: config-volume
      configMap:
        name: test-config-map
        items:
       - key: test.xml
          path: test-web/configs/test_config
  restartPolicy: Never
</code></pre>

<p>Also the configmap is getting mounted as root user where as we want the volume mount to happen as a specific user.</p>

<p>Can you please let me know what i may be missing in my yaml file to fix the above 2 issues.</p>

<p>In your case this should fit well:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-web
spec:
  containers:
    - name: test-web
      image: docker.io/hello-world
      volumeMounts:
      - name: config-volume-1
        mountPath: /usr/test1
      - name: config-volume-2
        mountPath: /usr/test2
  volumes:
    - name: config-volume-1
      configMap:
        name: test-config-map
        items:
        - key: application.properties 
          path: test-web
    - name: config-volume-2
      configMap:
        name: test-config-map
        items:
        - key: test.xml
          path: test-web/configs/test_config
  restartPolicy: Never
</code></pre>

<p>Reference is at: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/</a></p>
