简体   繁体   中英

How to convert an environment variable declared inside a "yaml" file to something inside the ".env" file?

I have an environment variable file that is declared like following inside a deployment.yaml file:

          env:
            - name: NATS_CLIENT_ID
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name

I am just wondering to know if I want to use an .env file instead of the deployment.yaml file, how can I declare the above port within the .env ?

Maybe you can create a configmap that contains your .env and use your configmap to inject the environment variables.

An example here: https://humanitec.com/blog/handling-environment-variables-with-kube.netes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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