0

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?

Hacker
  • 7,798
  • 19
  • 84
  • 154

1 Answers1

2

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

Hamed
  • 501
  • 3
  • 13
  • This is correct statement. It's not possible to refer to variables on a Kubernetes Manifest. This is nos supported and that's why we have solutions like Helm and Kustomize. They exist to fill a gap and let us create manifests programmatically. – Mark Watney Apr 29 '20 at 08:23