How to mark secret as optional in kubernetes?

2019-06-21 14:27发布

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?

标签: kubernetes
1条回答
你好瞎i
2楼-- · 2019-06-21 15:02

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

查看更多
登录 后发表回答