zh-trans:/docs/tasks/federation/administer-federation/configmap.md (#15842)

* .

* .

* Update configmap.md
This commit is contained in:
MJ-CJM
2019-08-16 09:02:35 +08:00
committed by Kubernetes Prow Robot
parent 1120f6c4a1
commit 02570857a9
@@ -2,7 +2,6 @@
title: 联邦 ConfigMap title: 联邦 ConfigMap
content_template: templates/task content_template: templates/task
--- ---
<!-- <!--
--- ---
title: Federated ConfigMap title: Federated ConfigMap
@@ -15,7 +14,6 @@ content_template: templates/task
{{< deprecationfilewarning >}} {{< deprecationfilewarning >}}
{{< include "federation-deprecation-warning-note.md" >}} {{< include "federation-deprecation-warning-note.md" >}}
{{< /deprecationfilewarning >}} {{< /deprecationfilewarning >}}
<!-- <!--
This guide explains how to use ConfigMaps in a Federation control plane. This guide explains how to use ConfigMaps in a Federation control plane.
@@ -24,87 +22,83 @@ ConfigMaps](/docs/tasks/configure-pod-container/configure-pod-configmap/) and pr
Creating them in the federation control plane ensures that they are synchronized Creating them in the federation control plane ensures that they are synchronized
across all the clusters in federation. across all the clusters in federation.
--> -->
本指南介绍如何在联邦控制平面中使用 ConfigMap。 本指南介绍如何在联邦控制平面中使用 ConfigMap。
联邦 ConfigMap 与传统 Kubernetes ConfigMap 非常相似,并提供相同的功能。在联邦控制平面中创建它们可确保它们在联邦中的所有集群之间同步。 联邦 ConfigMap 与传统 [Kubernetes
ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) 非常相似且提供相同的功能。
在联邦控制平面中创建它们可以确保它们在联邦的所有集群中同步。
{{% /capture %}} {{% /capture %}}
{{% capture prerequisites %}} {{% capture prerequisites %}}
* {{< include "federated-task-tutorial-prereqs.md" >}} * {{< include "federated-task-tutorial-prereqs.md" >}}
* 你应该具有基本的 [Kubernetes 工作知识](/docs/tutorials/kubernetes-basics/)
尤其是 [configmap](/docs/tasks/configure-pod-container/configure-pod-configmap/)。
<!-- <!--
You should also have a basic * You should also have a basic
[working knowledge of Kubernetes](/docs/tutorials/kubernetes-basics/) in [working knowledge of Kubernetes](/docs/tutorials/kubernetes-basics/) in
general and [ConfigMaps](/docs/tasks/configure-pod-container/configure-pod-configmap/) in particular. general and [ConfigMaps](/docs/tasks/configure-pod-container/configure-pod-configmap/) in particular.
--> -->
* 通常我们还期望您拥有基本的 [Kubernetes 应用知识](/docs/tutorials/kubernetes-basics/)
特别是 [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) 相关的应用知识。
{{% /capture %}} {{% /capture %}}
{{% capture steps %}} {{% capture steps %}}
<!-- <!--
## Creating a Federated ConfigMap ## Creating a Federated ConfigMap
-->
## 创建一个联邦 ConfigMap
<!--
The API for Federated ConfigMap is 100% compatible with the The API for Federated ConfigMap is 100% compatible with the
API for traditional Kubernetes ConfigMap. You can create a ConfigMap by sending API for traditional Kubernetes ConfigMap. You can create a ConfigMap by sending
a request to the federation apiserver. a request to the federation apiserver.
-->
联邦 ConfigMap 的 API 与传统 Kubernetes ConfigMap 的 API 100% 兼容。您可以通过向联邦身份验证程序发送请求来创建 ConfigMap。
<!-
You can do that using [kubectl](/docs/user-guide/kubectl/) by running: You can do that using [kubectl](/docs/user-guide/kubectl/) by running:
-->
您可以通过运行以下命令使用 [kubectl](/docs/user-guide/kubectl/) 执行此操作:
``` shell ``` shell
kubectl --context=federation-cluster create -f myconfigmap.yaml kubectl --context=federation-cluster create -f myconfigmap.yaml
``` ```
<!--
The `--context=federation-cluster` flag tells kubectl to submit the The `--context=federation-cluster` flag tells kubectl to submit the
request to the Federation apiserver instead of sending it to a Kubernetes request to the Federation apiserver instead of sending it to a Kubernetes
cluster. cluster.
-->
`--context=federation-cluster` 参数通知 kubectl 将请求提交给联邦 apiserver,而不是发送到 Kubernetes 集群。
<!--
Once a Federated ConfigMap is created, the federation control plane will create Once a Federated ConfigMap is created, the federation control plane will create
a matching ConfigMap in all underlying Kubernetes clusters. a matching ConfigMap in all underlying Kubernetes clusters.
You can verify this by checking each of the underlying clusters, for example: You can verify this by checking each of the underlying clusters, for example:
-->
一旦创建了联邦 ConfigMap,就会创建联邦控制平面。所有底层 Kubernetes 集群中创建匹配的ConfigMap
您可以通过检查每个底层集群来验证这一点,例如:
``` shell ``` shell
kubectl --context=gce-asia-east1a get configmap myconfigmap kubectl --context=gce-asia-east1a get configmap myconfigmap
``` ```
<!--
The above assumes that you have a context named 'gce-asia-east1a' The above assumes that you have a context named 'gce-asia-east1a'
configured in your client for your cluster in that zone. configured in your client for your cluster in that zone.
-->
以上假设您在客户端中为该区域中的集群配置了名为 'gce-asia-east1a' 的上下文。
<!--
These ConfigMaps in underlying clusters will match the Federated ConfigMap. These ConfigMaps in underlying clusters will match the Federated ConfigMap.
--> -->
底层集群中的这些 ConfigMap 将与联邦 ConfigMap 匹配。 ## 创建联邦 ConfigMap
联邦 ConfigMap 的 API 100% 兼容传统 Kubernetes ConfigMap 的 API。您可以通过向联邦 apiserver 发送请求来创建 ConfigMap。
您可以通过使用 [kubectl](/docs/user-guide/kubectl/) 运行下面的指令来创建联邦 ConfigMap:
``` shell
kubectl --context=federation-cluster create -f myconfigmap.yaml
```
`--context=federation-cluster` 参数告诉 kubectl 将请求提交到联邦 apiserver 而不是发送给某一个 Kubernetes 集群。
一旦联邦 ConfigMap 被创建,联邦控制平面就会在所有底层 Kubernetes 集群中创建匹配的 ConfigMap。
您可以通过检查底层每个集群来对其进行验证,例如:
``` shell
kubectl --context=gce-asia-east1a get configmap myconfigmap
```
上面的命令假定您在客户端中配置了一个叫做 ‘gce-asia-east1a 的上下文。
这些底层集群中的 ConfigMap 将与 联邦 ConfigMap 相匹配。
<!-- <!--
## Updating a Federated ConfigMap ## Updating a Federated ConfigMap
-->
## 更新联邦 ConfigMap
<!--
You can update a Federated ConfigMap as you would update a Kubernetes You can update a Federated ConfigMap as you would update a Kubernetes
ConfigMap; however, for a Federated ConfigMap, you must send the request to ConfigMap; however, for a Federated ConfigMap, you must send the request to
the federation apiserver instead of sending it to a specific Kubernetes cluster. the federation apiserver instead of sending it to a specific Kubernetes cluster.
@@ -112,28 +106,30 @@ The federation control plane ensures that whenever the Federated ConfigMap is
updated, it updates the corresponding ConfigMaps in all underlying clusters to updated, it updates the corresponding ConfigMaps in all underlying clusters to
match it. match it.
--> -->
您可以像更新 Kubernetes ConfigMap 一样更新Federated ConfigMap; ## 更新联邦 ConfigMap
但是,对于联邦 ConfigMap,您必须将请求发送到联邦 apiserver,而不是将其发送到指定的 Kubernetes 集群。
联邦控制平面确保每当更新联邦 ConfigMap 时,它都会更新所有基础集群中的相应 ConfigMaps 以匹配它 您可以像更新 Kubernetes ConfigMap 一样更新联邦 ConfigMap。
但是对于联邦 ConfigMap,您必须发送请求到联邦 apiserver 而不是某个特定的 Kubernetes 集群。
联邦控制平面会确保每当联邦 ConfigMap 更新时,它会更新所有底层集群中的 ConfigMap 来和更新后的内容保持一致。
<!-- <!--
## Deleting a Federated ConfigMap ## Deleting a Federated ConfigMap
-->
## 删除联邦 ConfigMap
<!--
You can delete a Federated ConfigMap as you would delete a Kubernetes You can delete a Federated ConfigMap as you would delete a Kubernetes
ConfigMap; however, for a Federated ConfigMap, you must send the request to ConfigMap; however, for a Federated ConfigMap, you must send the request to
the federation apiserver instead of sending it to a specific Kubernetes cluster. the federation apiserver instead of sending it to a specific Kubernetes cluster.
-->
您可以删除联邦 ConfigMap,就像删除 Kubernetes ConfigMap 一样;
但是,对于联邦 ConfigMap,您必须将请求发送到联邦 apiserver,而不是将其发送到指定的 Kubernetes 集群。
<!--
For example, you can do that using kubectl by running: For example, you can do that using kubectl by running:
```shell
kubectl --context=federation-cluster delete configmap
```
--> -->
例如,您可以通过运行以下命令使用 kubectl 执行此操作: ## 删除联邦 ConfigMap
您可以像删除 Kubernetes ConfigMap 一样删除联邦 ConfigMap。
但是,对于联邦 ConfigMap,您必须发送请求到联邦 apiserver 而不是某个特定的 Kubernetes 集群。
例如,您可以使用 kubectl 运行下面的命令来删除联邦 ConfigMap:
```shell ```shell
kubectl --context=federation-cluster delete configmap kubectl --context=federation-cluster delete configmap
@@ -143,7 +139,7 @@ kubectl --context=federation-cluster delete configmap
<!-- <!--
Deleting a Federated ConfigMap does not delete the corresponding ConfigMaps from underlying clusters. You must delete the underlying ConfigMaps manually. Deleting a Federated ConfigMap does not delete the corresponding ConfigMaps from underlying clusters. You must delete the underlying ConfigMaps manually.
--> -->
删除联邦 ConfigMap 不会从基础集群中删除相应的 ConfigMap。您必须手动删除基础 ConfigMap。 要注意的是这时删除联邦 ConfigMap 不会删除底层集群中对应的 ConfigMap。您必须自己手动删除底层集群中的 ConfigMap。
{{< /note >}} {{< /note >}}
{{% /capture %}} {{% /capture %}}