Reputation: 2474
From the docs:
Secrets must be created before they are consumed in pods as environment variables unless they are marked as optional. References to Secrets that do not exist will prevent the pod from starting.
How to mark secret as optional?
Upvotes: 35
Views: 18861
Reputation: 22884
What you're looking for is
- name: ENV_NAME
valueFrom:
secretKeyRef:
name: <secrets name>
key: <secrets key>
optional: true
You can find type definition here
Edit: similarly for envFrom
envFrom:
- secretRef:
name: secname
optional: true
Upvotes: 56