Hacker
Hacker

Reputation: 7906

generate dynamic secret name inside kubernetes deployment file

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?

Upvotes: 0

Views: 1234

Answers (1)

Hamed
Hamed

Reputation: 501

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

Upvotes: 2

Related Questions