如何在kubernetes中将secret标记为可选? [英] How to mark secret as optional in kubernetes?

查看:117
本文介绍了如何在kubernetes中将secret标记为可选?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从文档中

除非将秘密标记为可选,否则必须先创建秘密,然后再将其作为环境变量使用在pod中.引用不存在的机密将阻止容器启动.

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?

推荐答案

您正在寻找的是

  - name: ENV_NAME
    valueFrom:
      secretKeyRef:
        name: <secrets name>
        key: <secrets key>
        optional: true

您可以在此处

这篇关于如何在kubernetes中将secret标记为可选?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆