generate dynamic secret name inside kubernetes deployment file

烂漫一生 提交于 2020-05-17 07:03:07

问题


I have 2 secrets i.e. production and staging. I want to dynamically load this secret in deployment file using the environment variable being set in same file

env:
          - name: NODE_ENV
            value: "production"


 - name: general-secret
          secret:
            secretName: general-production-secret    

I want to load environment specific secrets like using

        secretName: general-{{env. NODE_ENV}}-secret    

Is it possible?


回答1:


As far as I know, this is not possible unless you have Helm chart for your applications, then you can make this possible

this is a solution in helm chart close to what you need Dynamically accessing values depending on variable values in a Helm chart



来源:https://stackoverflow.com/questions/61482060/generate-dynamic-secret-name-inside-kubernetes-deployment-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!