Skip to content

Commit a3423aa

Browse files
committed
improvement for 'Using environment variables inside of your config'
1 parent ec28eb0 commit a3423aa

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

content/en/docs/tasks/inject-data-application/define-environment-variable-container.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ the list. Similarly, avoid circular references.
9393

9494
## Using environment variables inside of your config
9595

96-
Environment variables that you define in a Pod's configuration can be used
97-
elsewhere in the configuration, for example in commands and arguments that
98-
you set for the Pod's containers.
96+
Environment variables that you define in a Pod's configuration under
97+
`.spec.containers[*].env[*]` can be used elsewhere in the configuration, for
98+
example in commands and arguments that you set for the Pod's containers.
9999
In the example configuration below, the `GREETING`, `HONORIFIC`, and
100100
`NAME` environment variables are set to `Warm greetings to`, `The Most
101-
Honorable`, and `Kubernetes`, respectively. Those environment variables
102-
are then used in the CLI arguments passed to the `env-print-demo`
103-
container.
101+
Honorable`, and `Kubernetes`, respectively. And the environment variable
102+
`MESSAGE` combines the set of all these environment variables and then used
103+
as a CLI argument passed to the `env-print-demo` container.
104104

105105
```yaml
106106
apiVersion: v1
@@ -118,8 +118,10 @@ spec:
118118
value: "The Most Honorable"
119119
- name: NAME
120120
value: "Kubernetes"
121+
- name: MESSAGE
122+
value: "$(GREETING) $(HONORIFIC) $(NAME)"
121123
command: ["echo"]
122-
args: ["$(GREETING) $(HONORIFIC) $(NAME)"]
124+
args: ["$(MESSAGE)"]
123125
```
124126
125127
Upon creation, the command `echo Warm greetings to The Most Honorable Kubernetes` is run on the container.

0 commit comments

Comments
 (0)