12

I have dozens of secrets to pass into a k8 deployment which becomes very verbose, bellow is an example of passing the redis secrets in from the redis-secrets secret.

- name: REDIS_HOST
  valueFrom:
    secretKeyRef:
      name: redis-secrets
      key: REDIS_HOST
- name: REDIS_PASSWORD
  valueFrom:
    secretKeyRef:
      name: redis-secrets
      key: REDIS_PASSWORD
- name: REDIS_PORT
  valueFrom:
    secretKeyRef:
      name: redis-secrets
      key: REDIS_PORT

Is it possible to pass all the secrets from redis-secrets into the deployment, with the keys of the secrets being the env variable key?

mohan08p
  • 5,002
  • 1
  • 28
  • 36
henry.oswald
  • 5,304
  • 13
  • 51
  • 73

1 Answers1

16

I used this for configmaps.

Same level as env which is .spec.containers:

envFrom:
   - secretRef:
       name: redis-secrets
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Bal Chua
  • 1,134
  • 9
  • 10