How to mark secret as optional in kubernetes?

2019-06-21 14:26发布

问题:

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?

回答1:

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



标签: kubernetes