<p>Having issue while creating configmap for directories and sub-directory and files. For example having folder structure as like below</p>
<pre><code>.
├── build
│   └── book
│       └── book.txt
├── deploy
│   └── k8
│       └── deploy.txt
└── test
    └── tablet
        └── tab.txt

6 directories, 3 files
</code></pre>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: testmap
  labels:
    conf: testmap
data:
</code></pre>
<p>I am really not sure how to implement to get config map for this, could you please some one help me on this.</p>

<p>Here the steps</p>
<pre><code>1) select your directory and make it as a tar file (i.e tar -zcvf file.tar.gz /tmp/file)
2) kubectl create configmap test-configmap --from-file=file.tar.gz --dry-run -o yaml &gt;test-configmap.yaml
3) create volume mounts

- mountPath: /tmp/file.tar.gz              
  subPath: file.tar.gz
  name: file

command: [&quot;/bin/sh&quot;]
args: [&quot;-c&quot;, &quot;tar -xf /tmp/file.tar.gz while true; do echo hello; sleep 10;done&quot;]

4) create volume as a config map

volumes:
- name: file
configMap: 
            
  name: file
  items:
            
  - key: file.tar.gz
    path: file.tar.gz
</code></pre>
