From 67ca8d8e2251c89057b3ee4f80d6e89a57930769 Mon Sep 17 00:00:00 2001 From: xieyanker Date: Thu, 6 Feb 2020 14:49:33 +0800 Subject: [PATCH] hide some original comments in translate docs (#18986) * hide original comment * hide some original comments --- .../docs/concepts/storage/storage-classes.md | 5 + .../workloads/controllers/deployment.md | 165 +++++++++++------- .../docs/reference/access-authn-authz/node.md | 3 + content/zh/docs/reference/kubectl/kubectl.md | 6 + .../create-external-load-balancer.md | 1 + .../tasks/administer-cluster/ip-masq-agent.md | 5 + .../tasks/administer-cluster/nodelocaldns.md | 1 + .../configure-volume-storage.md | 2 + .../federation/administer-federation/job.md | 1 + 9 files changed, 123 insertions(+), 66 deletions(-) diff --git a/content/zh/docs/concepts/storage/storage-classes.md b/content/zh/docs/concepts/storage/storage-classes.md index f51e62160a..3c7dc98bc8 100644 --- a/content/zh/docs/concepts/storage/storage-classes.md +++ b/content/zh/docs/concepts/storage/storage-classes.md @@ -431,6 +431,7 @@ parameters: type: pd-standard replication-type: none ``` + * [创建 Deployment 以展开 ReplicaSet ](#creating-a-deployment)。 ReplicaSet 在后台创建 Pods。检查 ReplicaSet 展开的状态,查看其是否成功。 + * [声明 Pod 的新状态](#updating-a-deployment) 通过更新 Deployment 的 PodTemplateSpec。将创建新的 ReplicaSet ,并且 Deployment 管理器以受控速率将 Pod 从旧 ReplicaSet 移动到新 ReplicaSet 。每个新的 ReplicaSet 都会更新 Deployment 的修改历史。 + * [回滚到较早的 Deployment 版本](#rolling-back-a-deployment),如果 Deployment 的当前状态不稳定。每次回滚都会更新 Deployment 的修改。 + * [扩展 Deployment 以承担更多负载](#scaling-a-deployment). + * [暂停 Deployment ](#pausing-and-resuming-a-deployment) 对其 PodTemplateSpec 进行修改,然后恢复它以启动新的展开。 + * [使用 Deployment 状态](#deployment-status) 作为卡住展开的指示器。 + * [清理较旧的 ReplicaSets ](#clean-up-policy) ,那些不在需要的。 + @@ -123,10 +130,12 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up * A Deployment named `nginx-deployment` is created, indicated by the `.metadata.name` field. --> * 将创建名为 `nginx-deployment` 的 Deployment ,由 `.metadata.name` 字段指示。 + * Deployment 创建三个复制的 Pods,由 `replicas` 字段指示。 + * `template` 字段包含以下子字段: - * Pod 标记为`app: nginx`,使用`labels`字段。 - * Pod 模板规范或 `.template.spec` 字段指示 Pods 运行一个容器, `nginx`,运行 `nginx` [Docker Hub](https://hub.docker.com/)版本1.7.9的镜像 。 - * 创建一个容器并使用`name`字段将其命名为 `nginx`。 - 按照以下步骤创建上述 Deployment : - 开始之前,请确保的 Kubernetes 集群已启动并运行。 - 1. 通过运行以下命令创建 Deployment : @@ -194,7 +206,7 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml ``` - 2. 运行 `kubectl get deployments` 以检查 Deployment 是否已创建。如果仍在创建 Deployment ,则输出以下内容: @@ -202,11 +214,12 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 3 0 0 0 1s ``` - 检查集群中的 Deployments 时,将显示以下字段: - 请注意,根据`.spec.replicas`副本字段,所需副本的数量为 3。 - 3. 要查看 Deployment 展开状态,运行 `kubectl rollout status deployment.v1.apps/nginx-deployment`。输出: @@ -235,7 +248,7 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up deployment.apps/nginx-deployment successfully rolled out ``` - 4. 几秒钟后再次运行 `kubectl get deployments`。输出: @@ -243,12 +256,12 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 3 3 3 3 18s ``` - 请注意, Deployment 已创建所有三个副本,并且所有副本都是最新的(它们包含最新的 Pod 模板)并且可用。 - 5. 要查看 Deployment 创建的 ReplicaSet (`rs`),运行 `kubectl get rs`。输出: @@ -256,13 +269,13 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up NAME DESIRED CURRENT READY AGE nginx-deployment-75675f5897 3 3 3 18s ``` - 请注意, ReplicaSet 的名称始终被格式化为`[DEPLOYMENT-NAME]-[RANDOM-STRING]`。随机字符串是随机生成并使用 pod-template-hash 作为种子。 - 6. 要查看每个 Pod 自动生成的标签,运行 `kubectl get pods --show-labels`。返回以下输出: @@ -272,13 +285,14 @@ The following is an example of a Deployment. It creates a ReplicaSet to bring up nginx-deployment-75675f5897-kzszj 1/1 Running 0 18s app=nginx,pod-template-hash=3123191453 nginx-deployment-75675f5897-qqcnn 1/1 Running 0 18s app=nginx,pod-template-hash=3123191453 ``` - 创建的复制集可确保有三个 `nginx` Pods。 {{< note >}} - @@ -334,7 +348,7 @@ is changed, for example if the labels or container images of the template are up ```shell kubectl --record deployment.apps/nginx-deployment set image deployment.v1.apps/nginx-deployment nginx=nginx:1.9.1 ``` - 输出: @@ -342,7 +356,7 @@ is changed, for example if the labels or container images of the template are up deployment.apps/nginx-deployment image updated ``` - 或者,可以 `edit` Deployment 并将 `.spec.template.spec.containers[0].image` 从 `nginx:1.7.9` 更改至 `nginx:1.9.1`。 @@ -351,7 +365,7 @@ is changed, for example if the labels or container images of the template are up kubectl edit deployment.v1.apps/nginx-deployment ``` - 输出: @@ -368,14 +382,14 @@ is changed, for example if the labels or container images of the template are up kubectl rollout status deployment.v1.apps/nginx-deployment ``` - 输出: ``` Waiting for rollout to finish: 2 out of 3 new replicas have been updated... ``` - 或者 @@ -409,7 +423,7 @@ up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas. kubectl get rs ``` - 输出: @@ -428,7 +442,7 @@ up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas. kubectl get pods ``` - 输出: @@ -439,24 +453,24 @@ up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas. nginx-deployment-1564180365-z9gth 1/1 Running 0 14s ``` - 下次要更新这些 Pods 时,只需再次更新 Deployment Pod 模板。 - Deployment 可确保在更新时仅关闭一定数量的 Pods。默认情况下,它确保至少 75%所需 Pods 运行(25%最大不可用)。 - Deployment 还确保仅创建一定数量的 Pods 高于期望的 Pods 数。默认情况下,它可确保最多增加 25% 期望 Pods 数(25%最大增量)。 - 输出: @@ -513,7 +527,7 @@ up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas. Normal ScalingReplicaSet 19s deployment-controller Scaled up replica set nginx-deployment-1564180365 to 3 Normal ScalingReplicaSet 14s deployment-controller Scaled down replica set nginx-deployment-2035384211 to 0 ``` - 输出: @@ -635,7 +649,7 @@ rolled back. kubectl rollout status deployment.v1.apps/nginx-deployment ``` - 输出: @@ -660,7 +674,7 @@ rolled back. kubectl get rs ``` - 输出: @@ -680,7 +694,7 @@ rolled back. kubectl get pods ``` - 输出: @@ -693,7 +707,7 @@ rolled back. ``` {{< note >}} - 输出: @@ -753,7 +767,7 @@ rolled back. 13s 13s 1 {deployment-controller } Normal ScalingReplicaSet Scaled up replica set nginx-deployment-3066724191 to 1 ``` - 要解决此问题,需要回滚到以前稳定的 Deployment 版本。 @@ -775,7 +789,7 @@ rolled back. ```shell kubectl rollout history deployment.v1.apps/nginx-deployment ``` - 输出: @@ -787,12 +801,12 @@ rolled back. 3 kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.91 --record=true ``` - `CHANGE-CAUSE` 从 Deployment 注释 `kubernetes.io/change-cause` 创建时复制到其修改版。可以通过以下条件指定 `CHANGE-CAUSE` 消息: - 输出: @@ -845,14 +859,14 @@ Follow the steps given below to rollback the Deployment from the current version kubectl rollout undo deployment.v1.apps/nginx-deployment ``` - 输出: ``` deployment.apps/nginx-deployment ``` - 或者,可以通过使用 `--to-revision` 来回滚到特定修改版本: @@ -861,7 +875,7 @@ Follow the steps given below to rollback the Deployment from the current version kubectl rollout undo deployment.v1.apps/nginx-deployment --to-revision=2 ``` - 输出: @@ -869,12 +883,12 @@ Follow the steps given below to rollback the Deployment from the current version deployment.apps/nginx-deployment ``` - 更多有关回滚相关指令,请参考 [`kubectl rollout`](/docs/reference/generated/kubectl/kubectl-commands#rollout). - @@ -888,7 +902,7 @@ Follow the steps given below to rollback the Deployment from the current version kubectl get deployment nginx-deployment ``` - 输出: @@ -896,6 +910,7 @@ Follow the steps given below to rollback the Deployment from the current version NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 3 3 3 3 30m ``` + @@ -903,7 +918,7 @@ Follow the steps given below to rollback the Deployment from the current version ```shell kubectl describe deployment nginx-deployment ``` - 输出: @@ -956,6 +971,7 @@ Follow the steps given below to rollback the Deployment from the current version --> ## 缩放 Deployment + @@ -964,6 +980,7 @@ Follow the steps given below to rollback the Deployment from the current version ```shell kubectl scale deployment.v1.apps/nginx-deployment --replicas=10 ``` + @@ -983,6 +1000,7 @@ Pods you want to run based on the CPU utilization of your existing Pods. ```shell kubectl autoscale deployment.v1.apps/nginx-deployment --min=10 --max=15 --cpu-percent=80 ``` + @@ -1016,7 +1034,8 @@ ReplicaSets (ReplicaSets with Pods) in order to mitigate risk. This is called *p ```shell kubectl get deploy ``` - 输出: @@ -1034,7 +1053,7 @@ ReplicaSets (ReplicaSets with Pods) in order to mitigate risk. This is called *p kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:sometag ``` - 输出: @@ -1050,7 +1069,7 @@ ReplicaSets (ReplicaSets with Pods) in order to mitigate risk. This is called *p ```shell kubectl get rs ``` - 输出: @@ -1089,6 +1108,7 @@ kubectl get deploy NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 15 18 7 8 7m ``` + @@ -1127,7 +1147,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess ```shell kubectl get deploy ``` - 输出: @@ -1135,14 +1155,16 @@ apply multiple fixes in between pausing and resuming without triggering unnecess NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx 3 3 3 3 1m ``` - 获取 Deployment 状态: ```shell kubectl get rs ``` - 输出: @@ -1159,7 +1181,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl rollout pause deployment.v1.apps/nginx-deployment ``` - 输出: @@ -1175,7 +1197,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.9.1 ``` - 输出: @@ -1191,7 +1213,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl rollout history deployment.v1.apps/nginx-deployment ``` - 输出: @@ -1200,6 +1222,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess REVISION CHANGE-CAUSE 1 ``` + @@ -1208,7 +1231,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl get rs ``` - 输出: @@ -1225,7 +1248,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl set resources deployment.v1.apps/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi ``` - 输出: @@ -1233,7 +1256,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess deployment.apps/nginx-deployment resource requirements updated ``` - @@ -1247,7 +1270,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl rollout resume deployment.v1.apps/nginx-deployment ``` - 输出: @@ -1262,7 +1285,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl get rs -w ``` - 输出: @@ -1283,6 +1306,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess nginx-2142116321 0 0 0 2m nginx-3926361531 3 3 3 20s ``` + @@ -1291,7 +1315,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess kubectl get rs ``` - 输出: @@ -1317,6 +1341,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess rolling out a new ReplicaSet, it can be [complete](#complete-deployment), or it can [fail to progress](#failed-deployment). --> 一个 Deployment 的生命周期中会有许多状态。当正在生产新的 ReplicaSet 时可能是[正在运行](#progressing-deployment),可能是[已完成](#complete-deployment),也可能是[ Deployment 失败](#failed-deployment)。 + @@ -1358,10 +1383,12 @@ Kubernetes 将 Deployment 标记为 _完成_,当它具有以下特征时: updates you've requested have been completed. --> * 与 Deployment 关联的所有副本都已更新到指定的最新版本,这意味着请求的任何更新都已完成。 + * 与 Deployment 关联的所有副本都可用。 + @@ -1376,6 +1403,7 @@ successfully, `kubectl rollout status` returns a zero exit code. ```shell kubectl rollout status deployment.v1.apps/nginx-deployment ``` + @@ -1396,7 +1424,7 @@ $ echo $? Your Deployment may get stuck trying to deploy its newest ReplicaSet without ever completing. This can occur due to some of the following factors: --> -的 Deployment 可能会在未完成的情况下尝试 Deployment 其最新的 ReplicaSet 时遇到问题。可能发生此情况由于以下一些因素: +你的 Deployment 可能会在未完成的情况下尝试 Deployment 其最新的 ReplicaSet 时遇到问题。可能发生此情况由于以下一些因素: @@ -1437,6 +1466,7 @@ kubectl patch deployment.v1.apps/nginx-deployment -p '{"spec":{"progressDeadline ``` deployment.apps/nginx-deployment patched ``` + @@ -1846,6 +1877,7 @@ a Pod is considered ready, see [Container Probes](/docs/concepts/workloads/pods/ Field `.spec.rollbackTo` has been deprecated in API versions `extensions/v1beta1` and `apps/v1beta1`, and is no longer supported in API versions starting `apps/v1beta2`. Instead, `kubectl rollout undo` as introduced in [Rolling Back to a Previous Revision](#rolling-back-to-a-previous-revision) should be used. --> `.spec.rollbackTo` 字段已经在 API 版本 `extensions/v1beta1` 和 `apps/v1beta1`中废弃了,并且从 `apps/v1beta2`版本开始不在支持。相应的,会开始使用已经引入[回滚到上一个版本](#rolling-back-to-a-previous-revision)中的 `kubectl rollout undo`。 + @@ -1894,6 +1926,7 @@ it is created. + * `service.spec.externalTrafficPolicy` - 表示此服务是否希望将外部流量路由到节点本地或集群范围的端点。有两个可用选项:Cluster(默认)和 Local。Cluster 隐藏了客户端源 IP,可能导致第二跳到另一个节点,但具有良好的整体负载分布。Local 保留客户端源 IP 并避免 LoadBalancer 和 NodePort 类型服务的第二跳,但存在潜在的不均衡流量传播风险。 + * **NAT (网络地址解析)** 是一种通过修改 IP 地址头中的源和/或目标地址信息将一个 IP 地址重新映射到另一个 IP 地址的方法。通常由执行 IP 路由的设备执行。 + * **伪装** NAT 的一种形式,通常用于执行多对一地址转换,其中多个源 IP 地址被隐藏在单个地址后面,该地址通常是执行 IP 路由的设备。在 Kubernetes 中,这是节点的 IP 地址。 + * **CIDR (无类别域间路由)** 基于可变长度子网掩码,允许指定任意长度的前缀。CIDR 引入了一种新的 IP 地址表示方法,现在通常称为**CIDR表示法**,其中地址或路由前缀后添加一个后缀,用来表示前缀的位数,例如 192.168.2.0/24。 + * **nonMasqueradeCIDRs:** [CIDR](https://zh.wikipedia.org/wiki/%E6%97%A0%E7%B1%BB%E5%88%AB%E5%9F%9F%E9%97%B4%E8%B7%AF%E7%94%B1) 表示法中的字符串列表,用于指定不需伪装的地址范围。 + * **masqLinkLocal:** 布尔值 (true / false),表示是否将流量伪装到本地链路前缀169.254.0.0/16。 默认为 false。 + diff --git a/content/zh/docs/tasks/administer-cluster/nodelocaldns.md b/content/zh/docs/tasks/administer-cluster/nodelocaldns.md index a4fb149636..2ae9d9d49b 100644 --- a/content/zh/docs/tasks/administer-cluster/nodelocaldns.md +++ b/content/zh/docs/tasks/administer-cluster/nodelocaldns.md @@ -120,6 +120,7 @@ This works for e2e clusters created on GCE. On all other environments, the follo * A yaml similar to [this](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml) can be applied using `kubectl create -f` command. --> * 可以使用 `kubectl create -f` 命令应用类似于[这个](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml)的 Yaml 。 + diff --git a/content/zh/docs/tasks/configure-pod-container/configure-volume-storage.md b/content/zh/docs/tasks/configure-pod-container/configure-volume-storage.md index 48499d6b12..192980e82c 100644 --- a/content/zh/docs/tasks/configure-pod-container/configure-volume-storage.md +++ b/content/zh/docs/tasks/configure-pod-container/configure-volume-storage.md @@ -40,6 +40,7 @@ applications, such as key-value stores (such as Redis) and databases. ## 为 Pod 配置卷 在本练习中,您将创建一个运行 Pod,该 Pod 仅运行一个容器并拥有一个类型为 [emptyDir](/docs/concepts/storage/volumes/#emptydir) 的卷,在整个 Pod 生命周期中一直存在,即使 Pod 中的容器被终止和重启。以下是 Pod 的配置: +