Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes -env and -envFrom environment variables setting

Tags:

kubernetes

Can Kubernetes deployment manifest file have both -env and -envFrom keys?

I have set a secrets.yaml file to set the environment variables and also have environment variables that are hard coded.

Can I have both of them set using both -env and -envFrom in the YAML files?

like image 557
Ajinkya16 Avatar asked Jan 25 '26 14:01

Ajinkya16


1 Answers

Can kubernetes deployment manifest file have both -env and -envFrom keys?

Yes.

...
envFrom:
- secretRef:
    name: <name of your secret>
env:
- name: <variable name>
  value: <hardcoded value>

- name: <variable name>
  valueFrom:
    secretKeyRef:
      name: <name of your secret>
      key: <If I only want this and not all the keys in the secret>
like image 129
gohm'c Avatar answered Jan 27 '26 13:01

gohm'c



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!