Skip to content

Commit f8f19ef

Browse files
authored
Merge pull request #34604 from tengqm/zh-resync-configpodcm
[zh-cn] Resync configure pod to use configmap page
2 parents 51fa56f + ec0f019 commit f8f19ef

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

content/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ Use the `kubectl create configmap` command to create ConfigMaps from [directorie
5252
-->
5353
### 使用 kubectl create configmap 创建 ConfigMap {#create-a-configmap-using-kubectl-create-configmap}
5454

55-
你可以使用 `kubectl create configmap`
56-
命令基于[目录](#create-configmaps-from-directories)
55+
你可以使用 `kubectl create configmap` 命令基于[目录](#create-configmaps-from-directories)
5756
[文件](#create-configmaps-from-files)或者[字面值](#create-configmaps-from-literal-values)来创建
5857
ConfigMap:
5958

@@ -72,8 +71,7 @@ The name of a ConfigMap object must be a valid
7271
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
7372
-->
7473
其中,`<映射名称>` 是为 ConfigMap 指定的名称,`<数据源>` 是要从中提取数据的目录、
75-
文件或者字面值。
76-
ConfigMap 对象的名称必须是合法的
74+
文件或者字面值。ConfigMap 对象的名称必须是合法的
7775
[DNS 子域名](/zh-cn/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
7876

7977
<!--
@@ -419,7 +417,8 @@ data:
419417
Starting with Kubernetes v1.23, `kubectl` supports the `--from-env-file` argument to be
420418
specified multiple times to create a ConfigMap from multiple data sources.
421419
-->
422-
从 Kubernetes 1.23 版本开始,`kubectl` 支持多次指定 `--from-env-file` 参数来从多个数据源创建 ConfigMap。
420+
从 Kubernetes 1.23 版本开始,`kubectl` 支持多次指定 `--from-env-file` 参数来从多个数据源创建
421+
ConfigMap。
423422

424423
```shell
425424
kubectl create configmap config-multi-env-files \
@@ -848,10 +847,10 @@ configmap/special-config-2-c92b5mmcf2 created
848847
-->
849848
## 将 ConfigMap 中的所有键值对配置为容器环境变量 {#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables}
850849

850+
{{< note >}}
851851
<!--
852852
This functionality is available in Kubernetes v1.6 and later.
853853
-->
854-
{{< note >}}
855854
Kubernetes v1.6 和更高版本支持此功能。
856855
{{< /note >}}
857856

@@ -990,17 +989,18 @@ Pod 运行时,命令 `ls /etc/config/` 产生下面的输出:
990989
SPECIAL_LEVEL
991990
SPECIAL_TYPE
992991
```
992+
993+
{{< caution >}}
993994
<!--
994995
If there are some files in the `/etc/config/` directory, they will be deleted.
995996
-->
996-
{{< caution >}}
997997
如果在 `/etc/config/` 目录中有一些文件,这些文件将被删除。
998998
{{< /caution >}}
999999

1000+
{{< note >}}
10001001
<!--
10011002
Text data is exposed as files using the UTF-8 character encoding. To use some other character encoding, use binaryData.
10021003
-->
1003-
{{< note >}}
10041004
文本数据会展现为 UTF-8 字符编码的文件。如果使用其他字符编码,
10051005
可以使用 `binaryData`
10061006
{{< /note >}}
@@ -1037,10 +1037,10 @@ When the pod runs, the command `cat /etc/config/keys` produces the output below:
10371037
very
10381038
```
10391039

1040+
{{< caution >}}
10401041
<!--
10411042
Like before, all previous files in the `/etc/config/` directory will be deleted.
10421043
-->
1043-
{{< caution >}}
10441044
如前,`/etc/config/` 目录中所有先前的文件都将被删除。
10451045
{{< /caution >}}
10461046

@@ -1084,20 +1084,18 @@ existence after a pod has started.
10841084
<!--
10851085
Kubelet checks whether the mounted ConfigMap is fresh on every periodic sync. However, it uses its local TTL-based cache for getting the current value of the
10861086
ConfigMap. As a result, the total delay from the moment when the ConfigMap is updated to the moment when new keys are projected to the pod can be as long as
1087-
kubelet sync period (1 minute by default) + TTL of ConfigMaps cache (1 minute by default) in kubelet. You can trigger an immediate refresh by updating one of
1088-
the pod's annotations.
1087+
kubelet sync period (1 minute by default) + TTL of ConfigMaps cache (1 minute by default) in kubelet.
10891088
-->
10901089
`kubelet` 在每次周期性同步时都会检查已挂载的 ConfigMap 是否是最新的。
10911090
但是,它使用其本地的基于 TTL 的缓存来获取 ConfigMap 的当前值。
10921091
因此,从更新 ConfigMap 到将新键映射到 Pod 的总延迟可能与
10931092
kubelet 同步周期(默认 1 分钟) + ConfigMap 在 kubelet 中缓存的 TTL
10941093
(默认 1 分钟)一样长。
1095-
你可以通过更新 Pod 的某个注解来触发立即更新。
10961094

1095+
{{< note >}}
10971096
<!--
10981097
A container using a ConfigMap as a [subPath](/docs/concepts/storage/volumes/#using-subpath) volume will not receive ConfigMap updates.
10991098
-->
1100-
{{< note >}}
11011099
使用 ConfigMap 作为 [subPath](/zh-cn/docs/concepts/storage/volumes/#using-subpath)
11021100
的数据卷将不会收到 ConfigMap 更新。
11031101
{{< /note >}}
@@ -1117,10 +1115,10 @@ ConfigMap 与 [Secret](/zh-cn/docs/concepts/configuration/secret/) 类似,
11171115
但是提供的是一种处理不含敏感信息的字符串的方法。
11181116
用户和系统组件都可以在 ConfigMap 中存储配置数据。
11191117

1118+
{{< note >}}
11201119
<!--
11211120
ConfigMaps should reference properties files, not replace them. Think of the ConfigMap as representing something similar to the Linux `/etc` directory and its contents. For example, if you create a [Kubernetes Volume](/docs/concepts/storage/volumes/) from a ConfigMap, each data item in the ConfigMap is represented by an individual file in the volume.
11221121
-->
1123-
{{< note >}}
11241122
ConfigMap 应该引用属性文件,而不是替换它们。可以将 ConfigMap 理解为类似于 Linux
11251123
`/etc` 目录及其内容的东西。例如,如果你基于 ConfigMap 创建
11261124
[Kubernetes 卷](/zh-cn/docs/concepts/storage/volumes/),则 ConfigMap

0 commit comments

Comments
 (0)