1

In my kubernetes deployment config, I want to fetch two environment variables from a secret map called "my-environment-config". Currently the way I do that is as follows:

    env:
      - name: INFLUXDB_DATA_ENGINE
        valueFrom:
          secretKeyRef:
            name: my-environment-config
            key: INFLUXDB_DATA_ENGINE
      - name: INFLUXDB_DATA_QUERY_LOG_ENABLED
        valueFrom:
          secretKeyRef:
            name: my-environment-config
            key: INFLUXDB_DATA_QUERY_LOG_ENABLED

This syntax seems to me to be overly verbose. Is there no shorthand for specifying this more elegantly?

PS: It is important to note that I don't want to expose ALL the secrets of my-environment-config, just a select few.

Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
  • This syntax is exactly the same like in the documentation https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables. There's no other ways as I can see. Why do you want to change it? – Serhii Rohoza Dec 26 '19 at 13:56
  • Becuase it is really too verbose. 5 lines per environment variable is a lot! – Mr. Developerdude Dec 29 '19 at 02:20

0 Answers0