title: How to mount same volume on to all pods in a kubernetes namespace
body: <p>We have a namespace in kubernetes where I would like some secrets (files like jks,properties,ts,etc.) to be made available to all the containers in all the pods (we have one JVM per container &amp; one container per pod kind of Deployment).</p>
  
  <p>I have created secrets using kustomization and plan to use it as a volume for spec of each Deployment &amp; then volumeMount it for the container of this Deployment. I would like to have this volume to be mounted on each of the containers deployed in our namespace.</p>
  
  <p>I want to know if kustomize (or anything else) can help me to mount this volume on all the deployments in this namespace?</p>
  
  <p>I have tried the following <code>patchesStrategicMerge</code></p>
  
  <pre><code>---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    namespace: myNamespace
  spec:
    template:
      spec:
        imagePullSecrets:
          - name: pull-secret
        containers:
          - volumeMounts:
            - name: secret-files
              mountPath: "/secrets"
              readOnly: true
        volumes:
        - name: secret-files
          secret:
            secretName: mySecrets
            items:
            - key: key1
              path: ...somePath
            - key: key2
              path: ...somePath
  </code></pre>
  
  <p>It requires name in <code>metadata</code> section which does not help me as all my Deployments have different names.</p>