What is the difference between env
and envFrom
fields in kubernetes when referencing secrets? Thank you!
Asked
Active
Viewed 476 times
1

Enis Mustafaj
- 33
- 1
- 6
1 Answers
2
Below is the "env:" sample which will load variables into container environment as environment variables which can referenced using "$DEMO_GREETING" then you will get "Hello from the environment"
env:
- name: DEMO_GREETING
value: "Hello from the environment"
- name: DEMO_FAREWELL
value: "Such a sweet sorrow"
Similarly you can load secret as environment variable as below
envFrom:
- secretRef:
name: mysecret
Here the secret will be loaded as environment variable and this can be referenced as $mysecret inside the container.

Nataraj Medayhal
- 980
- 1
- 2
- 12