I am having two different config maps test-configmap and common-config. I tried to mount them at the same location, but one config map over
NOTE: This approach is good if you have less amount of data in configmaps
Let's say you have two configmaps
test-confimap
apiVersion: v1
kind: ConfigMap
metadata:
name: test-configmap
data:
test-1.conf: |
test-property-1=test-value-1
common-confimap
apiVersion: v1
kind: ConfigMap
metadata:
name: common-configmap
data:
common-1.conf: |
common-property-1=common-value-1
Instead of having different configmaps you can have same data in single configmap like below.
apiVersion: v1
kind: ConfigMap
metadata:
name: single-configmap
data:
common-1.conf: |
property-1=value-1
test-1.conf: |
property-1=value-1
Now create a volume from above configmap and mount to container with mounhPath like below
volume from configmap
volumes:
- configMap:
defaultMode: 420
name: single-cofigmap
name: my-single-config
volumeMount
volumeMounts:
- mountPath: /path/to/config/folder/
name: my-single-config
Now you can see two files at the /path/to/config/folder/
location inside the container. Tell to your application to use which one it need.