<p>I have references to both Secrets and ConfigMaps in my Deployment YAML file. The Secret volume is mounting as expected, but not the ConfigMap.</p>
<p>I created a ConfigMap with multiple files and when I do a <code>kubectl get configmap ...</code> it shows all of the expected values. Also, when I create just ConfigMaps it's mounting the volume fine, but not along with a Secret.</p>
<p>I have tried different scenarios of having both in same directory to separating them but dont seem to work.</p>
<p>Here is my YAML. Am I referencing the ConfigMap correctly?</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-deployment
spec:
  selector:
    matchLabels:
      app: hello
  replicas: 1 # tells deployment to run 1 pod
  template:
    metadata:
      labels:
        app: hello
    spec:
      containers:
      - name: hello
        image: XXX/yyy/image-50
        ports:
        - containerPort: 9009
          protocol: TCP      
        volumeMounts:
        - mountPath: /shared
          name: configs-volume
          readOnly: true
        volumeMounts:
        - mountPath: data/secrets
          name: atp-secret
          readOnly: true
      volumes:
      - name: configs-volume
        configMap:
          name: prompts-config
          key: application.properties
      volumes:
      - name: atp-secret
        secret:
          defaultMode: 420
          secretName: dev-secret
      restartPolicy: Always
      imagePullSecrets:
      - name: ocirsecrets
</code></pre>

mamidala86
<p>You have two separate lists of <code>volumes:</code> and also two separate lists of <code>volumeMounts:</code>.  When Kubernetes tries to find the list of <code>volumes:</code> in the Pod spec, it finds the last matching one in each set.</p>
<pre class="lang-yaml prettyprint-override"><code>volumes:
- name: configs-volume
volumes: # this completely replaces the list of volumes
- name: atp-secret
</code></pre>
<p>In both cases you need a single <code>volumes:</code> or <code>volumeMounts:</code> key, and then multiple list items underneath those keys.</p>
<pre class="lang-yaml prettyprint-override"><code>volumes:
- name: configs-volume
  configMap: { ... }
- name: atp-secret                 # do not repeat volumes: key
  secret: { ... }
containers:
  - name: hello
    volumeMounts:
      - name: configs-volume
        mountPath: /shared
      - name: atp-secret           # do not repeat volumeMounts: key
        mounthPath: /data/secrets
</code></pre>
