-1

What is the difference between env and envFrom fields in kubernetes when referencing secrets? Thank you!

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.