Skip to content

Commit 8057934

Browse files
authored
Merge pull request #40568 from my-git9/path-3518
[zh-cn]sync define-environment-variable-container.md
2 parents 76baffc + 78bddab commit 8057934

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,41 @@ that run in the Pod. To set environment variables, include the `env` or
3636
-->
3737
创建 Pod 时,可以为其下的容器设置环境变量。通过配置文件的 `env` 或者 `envFrom` 字段来设置环境变量。
3838

39+
<!--
40+
The `env` and `envFrom` fields have different effects.
41+
42+
`env`
43+
: allows you to set environment variables for a container, specifying a value directly for each variable that you name.
44+
-->
45+
`env``envFrom` 字段具有不同的效果。
46+
47+
`env`
48+
:可以为容器设置环境变量,直接为你所给的每个变量指定一个值。
49+
50+
<!--
51+
`envFrom`
52+
: allows you to set environment variables for a container by referencing either a ConfigMap or a Secret.
53+
When you use `envFrom`, all the key-value pairs in the referenced ConfigMap or Secret
54+
are set as environment variables for the container.
55+
You can also specify a common prefix string.
56+
-->
57+
`envFrom`
58+
:你可以通过引用 ConfigMap 或 Secret 来设置容器的环境变量。
59+
使用 `envFrom` 时,引用的 ConfigMap 或 Secret 中的所有键值对都被设置为容器的环境变量。
60+
你也可以指定一个通用的前缀字符串。
61+
62+
<!--
63+
You can read more about [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables)
64+
and [Secret](/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables).
65+
66+
This page explains how to use `env`.
67+
-->
68+
你可以阅读有关 [ConfigMap](/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables)
69+
[Secret](/zh-cn/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables)
70+
的更多信息。
71+
72+
本页介绍如何使用 `env`
73+
3974
<!--
4075
In this exercise, you create a Pod that runs one container. The configuration
4176
file for the Pod defines an environment variable with name `DEMO_GREETING` and

0 commit comments

Comments
 (0)