1

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

Enis Mustafaj
  • 33
  • 1
  • 6

1 Answers1

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