docs: Resync configmap.md

pull/32707/head
阿杰鲁 2022-04-02 11:30:29 +08:00
parent ea0d0327c9
commit 8ab6120d12
2 changed files with 7 additions and 17 deletions

View File

@ -15,7 +15,6 @@ If the data you want to store are confidential, use a
or use additional (third party) tools to keep your data private.
{{< /caution >}}
<!-- body -->
## Motivation
@ -282,5 +281,3 @@ to the deleted ConfigMap, it is recommended to recreate these pods.
* Read [Configure a Pod to Use a ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/).
* Read [The Twelve-Factor App](https://12factor.net/) to understand the motivation for
separating code from configuration.

View File

@ -65,7 +65,7 @@ that lets you store configuration for other objects to use. Unlike most
Kubernetes objects that have a `spec`, a ConfigMap has `data` and `binaryData`
fields. These fields accept key-value pairs as their values. Both the `data`
field and the `binaryData` are optional. The `data` field is designed to
contain UTF-8 byte sequences while the `binaryData` field is designed to
contain UTF-8 strings while the `binaryData` field is designed to
contain binary data as base64-encoded strings.
The name of a ConfigMap must be a valid
@ -77,7 +77,7 @@ ConfigMap 是一个 API [对象](/zh/docs/concepts/overview/working-with-objects
让你可以存储其他对象所需要使用的配置。
和其他 Kubernetes 对象都有一个 `spec` 不同的是ConfigMap 使用 `data`
`binaryData` 字段。这些字段能够接收键-值对作为其取值。`data` 和 `binaryData`
字段都是可选的。`data` 字段设计用来保存 UTF-8 字节序列,而 `binaryData`
字段都是可选的。`data` 字段设计用来保存 UTF-8 字符串,而 `binaryData`
则被设计用来保存二进制数据作为 base64 编码的字串。
ConfigMap 的名字必须是一个合法的
@ -289,6 +289,8 @@ To consume a ConfigMap in a volume in a Pod:
-->
### 在 Pod 中将 ConfigMap 当做文件使用
要在一个 Pod 的存储卷中使用 ConfigMap:
<!--
1. Create a ConfigMap or use an existing one. Multiple Pods can reference the
same ConfigMap.
@ -384,19 +386,11 @@ ConfigMap 既可以通过 watch 操作实现内容传播(默认形式),也
(分别对应 watch 操作的传播延迟、高速缓存的 TTL 时长或者 0
<!--
ConfigMaps consumed as environment variables are not updated automatically and require a pod restart.
ConfigMaps consumed as environment variables are not updated automatically and require a pod restart.
-->
以环境变量方式使用的 ConfigMap 数据不会被自动更新。
更新这些数据需要重新启动 Pod。
{{< note >}}
<!--
A container using a ConfigMap as a [subPath](/docs/concepts/storage/volumes#using-subpath) volume mount will not receive ConfigMap updates.
-->
将 ConfigMap 作为 [subPath](/docs/concepts/storage/volumes#using-subpath)
卷挂载的容器无法收到 ConfigMap 更新。
{{< /note >}}
<!--
A container using a ConfigMap as a [subPath](/docs/concepts/storage/volumes#using-subpath) volume mount will not receive ConfigMap updates.
-->
@ -417,7 +411,7 @@ individual Secrets and ConfigMaps as immutable. For clusters that extensively us
(at least tens of thousands of unique ConfigMap to Pod mounts), preventing changes to their
data has the following advantages:
-->
Kubernetes 特性 _不可变更的 Secret 和 ConfigMap_ 提供了一种将各个
Kubernetes 特性 _Immutable Secret 和 ConfigMaps_ 提供了一种将各个
Secret 和 ConfigMap 设置为不可变更的选项。对于大量使用 ConfigMap 的集群
(至少有数万个各不相同的 ConfigMap 给 Pod 挂载)而言,禁止更改
ConfigMap 的数据有以下好处:
@ -460,7 +454,7 @@ to the deleted ConfigMap, it is recommended to recreate these pods.
-->
一旦某 ConfigMap 被标记为不可变更,则 _无法_ 逆转这一变化,,也无法更改
`data``binaryData` 字段的内容。你只能删除并重建 ConfigMap。
因为现有的 Pod 会维护一个已删除的 ConfigMap 的挂载点,建议重新创建这些 Pods。
因为现有的 Pod 会维护一个已删除的 ConfigMap 的挂载点,建议重新创建这些 Pods。
## {{% heading "whatsnext" %}}
@ -473,4 +467,3 @@ to the deleted ConfigMap, it is recommended to recreate these pods.
* 阅读 [Secret](/zh/docs/concepts/configuration/secret/)。
* 阅读[配置 Pod 使用 ConfigMap](/zh/docs/tasks/configure-pod-container/configure-pod-configmap/)。
* 阅读 [Twelve-Factor 应用](https://12factor.net/zh_cn/)来了解将代码和配置分开的动机。