<p>I am having two different config maps <strong>test-configmap</strong> and <strong>common-config</strong>. I tried to mount them at the same location, but one config map overwrote the other. Then I read about <code>subPath</code> and did not work.</p>

<p>deploy.yaml</p>

<pre><code>apiVersion: apps/v1beta1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
  name: testing
spec:
  replicas: 1
  template:
    metadata:
      name: testing
      labels:
        app: testing
    spec:
      containers:
      - name: testing-container
        image: testing
        imagePullPolicy: IfNotPresent
      ports:
      - containerPort: __PORT__
      volumeMounts:
      - name: commonconfig-volume
        mountPath: /usr/src/app/config/test.config
        subPath: test.config
    volumes:
      - name: commonconfig-volume
        configMap:
          name: test-configmap
      - name: commonconfig-volume
        configMap:
          name: common-config
</code></pre>

<p>Error :</p>

<p><code>The Deployment "testing" is invalid: spec.template.spec.volumes[1].name: Duplicate value: "commonconfig-volume"</code></p>

<p>I am not sure if merging two config map achievable of not. And if yes then how should I do it.</p>

<p>You have to use special <a href="https://kubernetes.io/docs/concepts/storage/volumes/#projected" rel="noreferrer">projected</a> volumes for achieve that. Example your deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: testing
spec:
  replicas: 1
  selector:
    matchLabels:
      app: testing
  template:
    metadata:
      name: testing
      labels:
        app: testing
    spec:
      containers:
      - name: testing-container
        image: testing
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: __PORT__
        volumeMounts:
        - name: commonconfig-volume
          mountPath: /usr/src/app/config
      volumes:
        - name: commonconfig-volume
          projected:
            sources:
            - configMap:
                name: test-configmap
            - configMap:
                name: common-config
</code></pre>

<p>You can use <code>secret</code> same as <code>configMap</code></p>
