<p>I have multiple Secrets in a Kubernetes. All of them contain many values, as example:</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: paypal-secret
type: Opaque
data:
  PAYPAL_CLIENT_ID: base64_PP_client_id
  PAYPAL_SECRET: base64_pp_secret
stringData:
  PAYPAL_API: https://api.paypal.com/v1
  PAYPAL_HOST: api.paypal.com
</code></pre>

<p>I'm curious how to pass all of the values from all <code>Secrets</code> to a <code>ReplicaSet</code> for example.</p>

<p>I tried this one approach:</p>

<pre><code>apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: pp-debts
  labels:
    environment: prod
spec:
  replicas: 1
  selector:
    matchLabels:
      environment: prod
  template:
    metadata:
      labels:
        environment: prod
    spec:
      containers:
      - name: integration-app
        image: my-container-image
        envFrom:
        - secretRef:
          name: intercom-secret
        envFrom:
        - secretRef:
            name: paypal-secret
        envFrom:
        - secretRef:
            name: postgres-secret
        envFrom:
        - secretRef:
            name: redis-secret
</code></pre>

<p>But when I connected to the pod, and looked on the env variables, I was able to see only values from the <code>redis-secret</code>.</p>

Alex Fruzenshtein
<p>Try using one <code>envFrom</code> with multiple entries under it as below:</p>
<pre><code>      - name: integration-app
        image: my-container-image
        envFrom:
        - secretRef:
            name: intercom-secret
        - secretRef:
            name: paypal-secret
        - secretRef:
            name: postgres-secret
        - secretRef:
            name: redis-secret
</code></pre>
<p>There's an example at the bottom of <a href="https://web.archive.org/web/20211122093817/https://dchua.com/posts/2017-04-21-load-env-variables-from-configmaps-and-secrets-upon-pod-boot/" rel="noreferrer">this blog post by David Chua</a></p>
