简体   繁体   English

Helm values.yaml 变量来自 kubernetes 秘密

[英]Helm values.yaml variables from kubernetes secret

I'm trying to use kubernetes secret in different helm charts and is any universal way to do it?我正在尝试在不同的掌舵图中使用 kubernetes 秘密,有什么通用的方法吗? For example I have grafana and admin password in helm values.yaml, and I want to keep it in k8s secret and load it into values.yaml.例如,我在 helm values.yaml 中有 grafana 和 admin 密码,我想将其保密在 k8s 中并将其加载到 values.yaml 中。 Is it possible?可能吗? Grafana have option like admin.existingSecret but I also want to do it with charts where they don't have that options. Grafana 有像 admin.existingSecret 这样的选项,但我也想用他们没有该选项的图表来做。 Is it possible to do it with有没有可能做到这一点

      valueFrom:
        secretKeyRef:
          name: mysecret
          key: WSO2_CLOUD_ORG_KEY

or with或与

envFromSecrets: "" 

I tried to use it in values.yaml in elasticsearch exportet but it didn't work and I'm looking for any universal way to do it.我试图在 values.yaml 在 elasticsearch exportet 中使用它,但它没有用,我正在寻找任何通用的方法来做到这一点。 I tried:我试过了:

envFromSecrets: "secret"
es:
  uri: ${secret}

I want to keep it in k8s secret and load it into values.yaml我想将它保存在 k8s 中并将其加载到 values.yaml

No it's not possible however you can create a template in the chart so if the secret is missing it will create the one with value不,这是不可能的,但是您可以在图表中创建一个模板,因此如果缺少秘密,它将创建具有价值的模板

Not sure which chart you are using but can checkout the不确定您使用的是哪个图表,但可以查看

https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml#L342 https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml#L342

values.yaml值。yaml

# Administrator credentials when not using an existing secret (see below)
adminUser: admin
# adminPassword: strongpassword

if you want to use the existing secret you can mention it in this section along with the user key and password key ref.如果您想使用现有的秘密,您可以在本节中提及它以及用户密钥和密码密钥参考。

# Use an existing secret for the admin user.
admin:
  ## Name of the secret. Can be templated.
  existingSecret: ""
  userKey: admin-user
  passwordKey: admin-password

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM