Skip to content

Commit a7a9a04

Browse files
authored
Merge pull request #25187 from tengqm/zh-sync-11
[zh] Sync changes from English site (11)
2 parents bd59f55 + aca3e08 commit a7a9a04

9 files changed

+115
-548
lines changed

content/zh/docs/tasks/administer-cluster/cluster-management.md

Lines changed: 0 additions & 452 deletions
This file was deleted.

content/zh/docs/tasks/administer-cluster/declare-network-policy.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ This document helps you get started using the Kubernetes [NetworkPolicy API](/do
2121
[NetworkPolicy API](/zh/docs/concepts/services-networking/network-policies/)
2222
声明网络策略去管理 Pod 之间的通信
2323

24+
{{% thirdparty-content %}}
25+
2426
## {{% heading "prerequisites" %}}
2527

2628
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
@@ -42,14 +44,6 @@ Make sure you've configured a network provider with network policy support. Ther
4244
* [Romana](/zh/docs/tasks/administer-cluster/network-policy-provider/romana-network-policy/)
4345
* [Weave 网络](/zh/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/)
4446

45-
<!--
46-
The above list is sorted alphabetically by product name, not by recommendation or preference. This example is valid for a Kubernetes cluster using any of these providers.
47-
-->
48-
{{< note >}}
49-
以上列表是根据产品名称按字母顺序排序,而不是按推荐或偏好排序。
50-
下面示例对于使用了上面任何提供商的 Kubernetes 集群都是有效的
51-
{{< /note >}}
52-
5347
<!-- steps -->
5448

5549
<!--
@@ -74,7 +68,7 @@ Expose the Deployment through a Service called `nginx`.
7468
-->
7569
将此 Deployment 以名为 `nginx` 的 Service 暴露出来:
7670

77-
```console
71+
```shell
7872
kubectl expose deployment nginx --port=80
7973
```
8074

@@ -89,7 +83,7 @@ The above commands create a Deployment with an nginx Pod and expose the Deployme
8983
Service 暴露出来。名为 `nginx` 的 Pod 和 Deployment 都位于 `default`
9084
名字空间内。
9185

92-
```console
86+
```shell
9387
kubectl get svc,pod
9488
```
9589
```none
@@ -111,7 +105,7 @@ You should be able to access the new `nginx` service from other Pods. To access
111105
你应该可以从其它的 Pod 访问这个新的 `nginx` 服务。
112106
要从 default 命名空间中的其它s Pod 来访问该服务。可以启动一个 busybox 容器:
113107

114-
```console
108+
```shell
115109
kubectl run busybox --rm -ti --image=busybox /bin/sh
116110
```
117111

@@ -167,7 +161,7 @@ Use kubectl to create a NetworkPolicy from the above `nginx-policy.yaml` file:
167161

168162
使用 kubectl 根据上面的 `nginx-policy.yaml` 文件创建一个 NetworkPolicy:
169163

170-
```console
164+
```shell
171165
kubectl apply -f https://k8s.io/examples/service/networking/nginx-policy.yaml
172166
```
173167
```none
@@ -183,7 +177,7 @@ When you attempt to access the `nginx` Service from a Pod without the correct la
183177

184178
如果你尝试从没有设定正确标签的 Pod 中去访问 `nginx` 服务,请求将会超时:
185179

186-
```console
180+
```shell
187181
kubectl run busybox --rm -ti --image=busybox -- /bin/sh
188182
```
189183

@@ -210,7 +204,7 @@ You can create a Pod with the correct labels to see that the request is allowed:
210204

211205
创建一个拥有正确标签的 Pod,你将看到请求是被允许的:
212206

213-
```console
207+
```shell
214208
kubectl run busybox --rm -ti --labels="access=true" --image=busybox -- /bin/sh
215209
```
216210
<!--

content/zh/docs/tasks/administer-cluster/dns-horizontal-autoscaling.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ The idea is that when a cluster is using nodes that have many cores,
252252
cores, `nodesPerReplica` dominates.
253253
254254
There are other supported scaling patterns. For details, see
255-
[cluster-proportional-autoscaler](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler).
255+
[cluster-proportional-autoscaler](https://github.com/kubernetes-sigs/cluster-proportional-autoscaler).
256256
-->
257257
注意 `coresPerReplica``nodesPerReplica` 的值都是整数。
258258

259259
背后的思想是,当一个集群使用具有很多核心的节点时,由 `coresPerReplica` 来控制。
260260
当一个集群使用具有较少核心的节点时,由 `nodesPerReplica` 来控制。
261261

262262
其它的扩缩模式也是支持的,详情查看
263-
[cluster-proportional-autoscaler](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler)
263+
[cluster-proportional-autoscaler](https://github.com/kubernetes-sigs/cluster-proportional-autoscaler)
264264

265265
<!--
266266
## Disable DNS horizontal autoscaling
@@ -409,9 +409,9 @@ patterns: *linear* and *ladder*.
409409
<!--
410410
* Read about [Guaranteed Scheduling For Critical Add-On Pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/).
411411
* Learn more about the
412-
[implementation of cluster-proportional-autoscaler](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler).
412+
[implementation of cluster-proportional-autoscaler](https://github.com/kubernetes-sigs/cluster-proportional-autoscaler).
413413
414414
-->
415415
* 阅读[为关键插件 Pod 提供的调度保障](/zh/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/)
416-
* 进一步了解 [cluster-proportional-autoscaler 实现](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler)
416+
* 进一步了解 [cluster-proportional-autoscaler 实现](https://github.com/kubernetes-sigs/cluster-proportional-autoscaler)
417417

content/zh/docs/tasks/administer-cluster/namespaces-walkthrough.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,7 @@ Production likes to run cattle, so let's create some cattle pods.
397397
生产环境需要以放牛的方式运维,让我们创建一些名为 `cattle` 的 Pod。
398398

399399
```shell
400-
kubectl create deployment cattle --image=k8s.gcr.io/serve_hostname
401-
kubectl scale deployment cattle --replicas=5
402-
400+
kubectl create deployment cattle --image=k8s.gcr.io/serve_hostname --replicas=5
403401
kubectl get deployment
404402
```
405403

content/zh/docs/tasks/configure-pod-container/assign-cpu-resource.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ allocated as much CPU as it requests.
3030
Each node in your cluster must have at least 1 CPU.
3131
3232
A few of the steps on this page require you to run the
33-
[metrics-server](https://github.com/kubernetes-incubator/metrics-server)
33+
[metrics-server](https://github.com/kubernetes-sigs/metrics-server)
3434
service in your cluster. If you have the metrics-server
3535
running, you can skip those steps.
3636
@@ -39,7 +39,8 @@ following command to enable metrics-server:
3939
-->
4040
集群中的每个节点必须至少有 1 个 CPU 可用才能运行本任务中的示例。
4141

42-
本页的一些步骤要求你在集群中运行[metrics-server](https://github.com/kubernetes-incubator/metrics-server)
42+
本页的一些步骤要求你在集群中运行
43+
[metrics-server](https://github.com/kubernetes-sigs/metrics-server)
4344
服务。如果你的集群中已经有正在运行的 metrics-server 服务,可以跳过这些步骤。
4445

4546
如果你正在运行{{< glossary_tooltip term_id="minikube" >}},请运行以下命令启用 metrics-server:
@@ -354,6 +355,20 @@ to specify a default value for the CPU limit.
354355
[LimitRange](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#limitrange-v1-core/)
355356
指定 CPU 限制的默认值。
356357

358+
<!--
359+
## If you specify a CPU limit but do not specify a CPU request
360+
361+
If you specify a CPU limit for a Container but do not specify a CPU request, Kubernetes automatically
362+
assigns a CPU request that matches the limit. Similarly, if a Container specifies its own memory limit,
363+
but does not specify a memory request, Kubernetes automatically assigns a memory request that matches
364+
the limit.
365+
-->
366+
## 如果你设置了 CPU 限制但未设置 CPU 请求
367+
368+
如果你为容器指定了 CPU 限制值但未为其设置 CPU 请求,Kubernetes 会自动为其
369+
设置与 CPU 限制相同的 CPU 请求值。类似的,如果容器设置了内存限制值但未设置
370+
内存请求值,Kubernetes 也会为其设置与内存限制值相同的内存请求。
371+
357372
<!--
358373
## Motivation for CPU requests and limits
359374

content/zh/docs/tasks/configure-pod-container/assign-memory-resource.md

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ weight: 10
55
---
66

77
<!--
8-
---
98
title: Assign Memory Resources to Containers and Pods
109
content_type: task
1110
weight: 10
12-
---
1311
-->
1412

1513
<!-- overview -->
@@ -19,34 +17,33 @@ This page shows how to assign a memory *request* and a memory *limit* to a
1917
Container. A Container is guaranteed to have as much memory as it requests,
2018
but is not allowed to use more memory than its limit.
2119
-->
22-
此页面显示如何将内存 *请求* (request)和内存 *限制* (limit)分配给一个容器。我们保障容器拥有它请求数量的内存,但不允许使用超过限制数量的内存。
23-
24-
25-
20+
此页面展示如何将内存 *请求* (request)和内存 *限制* (limit)分配给一个容器。
21+
我们保障容器拥有它请求数量的内存,但不允许使用超过限制数量的内存。
2622

2723
## {{% heading "prerequisites" %}}
2824

29-
3025
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
3126

3227
<!--
3328
Each node in your cluster must have at least 300 MiB of memory.
3429
-->
35-
您集群中的每个节点必须拥有至少 300 MiB 的内存。
30+
你集群中的每个节点必须拥有至少 300 MiB 的内存。
3631

3732
<!--
3833
A few of the steps on this page require you to run the
39-
[metrics-server](https://github.com/kubernetes-incubator/metrics-server)
34+
[metrics-server](https://github.com/kubernetes-sigs/metrics-server)
4035
service in your cluster. If you have the metrics-server
4136
running, you can skip those steps.
4237
-->
43-
该页面上的一些步骤要求您在集群中运行 [metrics-server](https://github.com/kubernetes-incubator/metrics-server) 服务。如果您已经有在运行中的 metrics-server,则可以跳过这些步骤。
38+
该页面上的一些步骤要求你在集群中运行
39+
[metrics-server](https://github.com/kubernetes-sigs/metrics-server) 服务。
40+
如果你已经有在运行中的 metrics-server,则可以跳过这些步骤。
4441

4542
<!--
4643
If you are running Minikube, run the following command to enable the
4744
metrics-server:
4845
-->
49-
如果您运行的是 Minikube,可以运行下面的命令启用 metrics-server:
46+
如果你运行的是 Minikube,可以运行下面的命令启用 metrics-server:
5047

5148
```shell
5249
minikube addons enable metrics-server
@@ -68,13 +65,11 @@ reference to `metrics.k8s.io`.
6865
-->
6966
如果资源指标 API 可用,则输出结果将包含对 `metrics.k8s.io` 的引用信息。
7067

71-
```shell
68+
```
7269
NAME
7370
v1beta1.metrics.k8s.io
7471
```
7572

76-
77-
7873
<!-- steps -->
7974

8075
<!--
@@ -106,7 +101,7 @@ for the Pod:
106101
要为容器指定内存请求,请在容器资源清单中包含 `resources:requests` 字段。
107102
同理,要指定内存限制,请包含 `resources:limits`
108103

109-
在本练习中,您将创建一个拥有一个容器的 Pod。
104+
在本练习中,你将创建一个拥有一个容器的 Pod。
110105
容器将会请求 100 MiB 内存,并且内存会被限制在 200 MiB 以内。
111106
这是 Pod 的配置文件:
112107

@@ -203,16 +198,18 @@ restarted, the kubelet restarts it, as with any other type of runtime failure.
203198
-->
204199
## 超过容器限制的内存
205200

206-
当节点拥有足够的可用内存时,容器可以使用其请求的内存。但是,容器不允许使用超过其限制的内存。
207-
如果容器分配的内存超过其限制,该容器会成为被终止的候选容器。如果容器继续消耗超出其限制的内存,则终止容器。
201+
当节点拥有足够的可用内存时,容器可以使用其请求的内存。
202+
但是,容器不允许使用超过其限制的内存。
203+
如果容器分配的内存超过其限制,该容器会成为被终止的候选容器。
204+
如果容器继续消耗超出其限制的内存,则终止容器。
208205
如果终止的容器可以被重启,则 kubelet 会重新启动它,就像其他任何类型的运行时失败一样。
209206

210207
<!--
211208
In this exercise, you create a Pod that attempts to allocate more memory than its limit.
212209
Here is the configuration file for a Pod that has one Container with a
213210
memory request of 50 MiB and a memory limit of 100 MiB:
214211
-->
215-
在本练习中,您将创建一个 Pod,尝试分配超出其限制的内存。
212+
在本练习中,你将创建一个 Pod,尝试分配超出其限制的内存。
216213
这是一个 Pod 的配置文件,其拥有一个容器,该容器的内存请求为 50 MiB,内存限制为 100 MiB:
217214

218215
{{< codenew file="pods/resource/memory-request-limit-2.yaml" >}}
@@ -223,7 +220,7 @@ will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limi
223220
224221
Create the Pod:
225222
-->
226-
在配置文件的 `args` 部分中,您可以看到容器会尝试分配 250 MiB 内存,这远高于 100 MiB 的限制。
223+
在配置文件的 `args` 部分中,你可以看到容器会尝试分配 250 MiB 内存,这远高于 100 MiB 的限制。
227224

228225
创建 Pod:
229226

@@ -277,7 +274,8 @@ lastState:
277274
The Container in this exercise can be restarted, so the kubelet restarts it. Repeat
278275
this command several times to see that the Container is repeatedly killed and restarted:
279276
-->
280-
本练习中的容器可以被重启,所以 kubelet 会重启它。多次运行下面的命令,可以看到容器在反复的被杀死和重启:
277+
本练习中的容器可以被重启,所以 kubelet 会重启它。
278+
多次运行下面的命令,可以看到容器在反复的被杀死和重启:
281279

282280
```shell
283281
kubectl get pod memory-demo-2 --namespace=mem-example
@@ -371,8 +369,8 @@ of any Node in your cluster.
371369
-->
372370
Pod 的调度基于请求。只有当节点拥有足够满足 Pod 内存请求的内存时,才会将 Pod 调度至节点上运行。
373371

374-
在本练习中,你将创建一个 Pod,其内存请求超过了您集群中的任意一个节点所拥有的内存
375-
这是该 Pod 的配置文件,其拥有一个请求 1000 GiB 内存的容器,这应该超过了您集群中任何节点的容量
372+
在本练习中,你将创建一个 Pod,其内存请求超过了你集群中的任意一个节点所拥有的内存
373+
这是该 Pod 的配置文件,其拥有一个请求 1000 GiB 内存的容器,这应该超过了你集群中任何节点的容量
376374

377375
{{< codenew file="pods/resource/memory-request-limit-3.yaml" >}}
378376

@@ -397,7 +395,8 @@ kubectl get pod memory-demo-3 --namespace=mem-example
397395
<!--
398396
The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:
399397
-->
400-
输出结果显示:Pod 处于 PENDING 状态。这意味着,该 Pod 没有被调度至任何节点上运行,并且它会无限期的保持该状态:
398+
输出结果显示:Pod 处于 PENDING 状态。
399+
这意味着,该 Pod 没有被调度至任何节点上运行,并且它会无限期的保持该状态:
401400

402401
```
403402
kubectl get pod memory-demo-3 --namespace=mem-example
@@ -436,7 +435,9 @@ For example, the following represent approximately the same value:
436435
-->
437436
## 内存单位
438437

439-
内存资源的基本单位是字节(byte)。您可以使用这些后缀之一,将内存表示为纯整数或定点整数:E、P、T、G、M、K、Ei、Pi、Ti、Gi、Mi、Ki。例如,下面是一些近似相同的值:
438+
内存资源的基本单位是字节(byte)。你可以使用这些后缀之一,将内存表示为
439+
纯整数或定点整数:E、P、T、G、M、K、Ei、Pi、Ti、Gi、Mi、Ki。
440+
例如,下面是一些近似相同的值:
440441

441442
```shell
442443
128974848, 129e6, 129M , 123Mi
@@ -469,12 +470,13 @@ Container is automatically assigned the default limit. Cluster administrators ca
469470
[LimitRange](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#limitrange-v1-core)
470471
to specify a default value for the memory limit.
471472
-->
472-
* 容器可无限制地使用内存。容器可以使用其所在节点所有的可用内存,进而可能导致该节点调用 OOM Killer。
473-
此外,如果发生 OOM Kill,没有资源限制的容器将被杀掉的可行性更大。
473+
* 容器可无限制地使用内存。容器可以使用其所在节点所有的可用内存,
474+
进而可能导致该节点调用 OOM Killer。
475+
此外,如果发生 OOM Kill,没有资源限制的容器将被杀掉的可行性更大。
474476

475477
* 运行的容器所在命名空间有默认的内存限制,那么该容器会被自动分配默认限制。
476-
集群管理员可用使用 [LimitRange](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#limitrange-v1-core)
477-
来指定默认的内存限制。
478+
集群管理员可用使用 [LimitRange](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#limitrange-v1-core)
479+
来指定默认的内存限制。
478480

479481
<!--
480482
## Motivation for memory requests and limits
@@ -486,7 +488,9 @@ scheduled. By having a memory limit that is greater than the memory request, you
486488
-->
487489
## 内存请求和限制的目的
488490

489-
通过为集群中运行的容器配置内存请求和限制,您可以有效利用集群节点上可用的内存资源。通过将 Pod 的内存请求保持在较低水平,您可以更好地安排 Pod 调度。通过让内存限制大于内存请求,您可以完成两件事:
491+
通过为集群中运行的容器配置内存请求和限制,你可以有效利用集群节点上可用的内存资源。
492+
通过将 Pod 的内存请求保持在较低水平,你可以更好地安排 Pod 调度。
493+
通过让内存限制大于内存请求,你可以完成两件事:
490494

491495
<!--
492496
* The Pod can have bursts of activity where it makes use of memory that happens to be available.
@@ -508,34 +512,46 @@ Delete your namespace. This deletes all the Pods that you created for this task:
508512
kubectl delete namespace mem-example
509513
```
510514

511-
512-
513515
## {{% heading "whatsnext" %}}
514516

517+
<!--
518+
### For app developers
519+
520+
* [Assign CPU Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-cpu-resource/)
515521
522+
* [Configure Quality of Service for Pods](/docs/tasks/configure-pod-container/quality-service-pod/)
523+
-->
516524
### 应用开发者扩展阅读
517525

518526
* [为容器和 Pod 分配 CPU 资源](/zh/docs/tasks/configure-pod-container/assign-cpu-resource/)
519527

520528
* [配置 Pod 的服务质量](/zh/docs/tasks/configure-pod-container/quality-service-pod/)
521529

522-
### 集群管理员扩展阅读
523-
524-
* [为命名空间配置默认的内存请求和限制](/zh/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)
525530

526-
* [为命名空间配置默认的 CPU 请求和限制](/zh/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/)
531+
<!--
532+
### For cluster administrators
527533
528-
* [配置命名空间的最小和最大内存约束](/zh/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/)
534+
* [Configure Default Memory Requests and Limits for a Namespace](/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)
529535
530-
* [配置命名空间的最小和最大 CPU 约束](/zh/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/)
536+
* [Configure Default CPU Requests and Limits for a Namespace](/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/)
531537
532-
* [为命名空间配置内存和 CPU 配额](/zh/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/)
538+
* [Configure Minimum and Maximum Memory Constraints for a Namespace](/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/)
533539
534-
* [配置命名空间下 Pod 总数](/zh/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/)
535-
536-
* [配置 API 对象配额](/zh/docs/tasks/administer-cluster/quota-api-object/)
540+
* [Configure Minimum and Maximum CPU Constraints for a Namespace](/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/)
537541
542+
* [Configure Memory and CPU Quotas for a Namespace](/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/)
538543
544+
* [Configure a Pod Quota for a Namespace](/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/)
539545
546+
* [Configure Quotas for API Objects](/docs/tasks/administer-cluster/quota-api-object/)
547+
-->
548+
### 集群管理员扩展阅读
540549

550+
* [为命名空间配置默认的内存请求和限制](/zh/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)
551+
* [为命名空间配置默认的 CPU 请求和限制](/zh/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/)
552+
* [配置命名空间的最小和最大内存约束](/zh/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/)
553+
* [配置命名空间的最小和最大 CPU 约束](/zh/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/)
554+
* [为命名空间配置内存和 CPU 配额](/zh/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/)
555+
* [配置命名空间下 Pod 总数](/zh/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/)
556+
* [配置 API 对象配额](/zh/docs/tasks/administer-cluster/quota-api-object/)
541557

0 commit comments

Comments
 (0)