Skip to content

Commit c4aea8c

Browse files
committed
[zh-cn]sync patch-releases network-policies
Signed-off-by: xin.li <[email protected]>
1 parent b1eb904 commit c4aea8c

File tree

2 files changed

+54
-53
lines changed

2 files changed

+54
-53
lines changed

content/zh-cn/docs/concepts/services-networking/network-policies.md

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ description: >-
2828
<!--
2929
If you want to control traffic flow at the IP address or port level for TCP, UDP, and SCTP protocols,
3030
then you might consider using Kubernetes NetworkPolicies for particular applications in your cluster.
31-
NetworkPolicies are an application-centric construct which allow you to specify how a {{<
32-
glossary_tooltip text="pod" term_id="pod">}} is allowed to communicate with various network
31+
NetworkPolicies are an application-centric construct which allow you to specify how a
32+
{{< glossary_tooltip text="pod" term_id="pod">}} is allowed to communicate with various network
3333
"entities" (we use the word "entity" here to avoid overloading the more common terms such as
3434
"endpoints" and "services", which have specific Kubernetes connotations) over the network.
3535
NetworkPolicies apply to a connection with a pod on one or both ends, and are not relevant to
@@ -45,11 +45,11 @@ NetworkPolicy 适用于一端或两端与 Pod 的连接,与其他连接无关
4545

4646
<!--
4747
The entities that a Pod can communicate with are identified through a combination of the following
48-
3 identifiers:
48+
three identifiers:
4949
5050
1. Other pods that are allowed (exception: a pod cannot block access to itself)
51-
2. Namespaces that are allowed
52-
3. IP blocks (exception: traffic to and from the node where a Pod is running is always allowed,
51+
1. Namespaces that are allowed
52+
1. IP blocks (exception: traffic to and from the node where a Pod is running is always allowed,
5353
regardless of the IP address of the Pod or the node)
5454
-->
5555
Pod 可以与之通信的实体是通过如下三个标识符的组合来辩识的:
@@ -60,11 +60,11 @@ Pod 可以与之通信的实体是通过如下三个标识符的组合来辩识
6060
无论 Pod 或节点的 IP 地址)
6161

6262
<!--
63-
When defining a pod- or namespace- based NetworkPolicy, you use a
63+
When defining a pod- or namespace-based NetworkPolicy, you use a
6464
{{< glossary_tooltip text="selector" term_id="selector">}} to specify what traffic is allowed to
6565
and from the Pod(s) that match the selector.
6666
67-
Meanwhile, when IP based NetworkPolicies are created, we define policies based on IP blocks (CIDR ranges).
67+
Meanwhile, when IP-based NetworkPolicies are created, we define policies based on IP blocks (CIDR ranges).
6868
-->
6969
在定义基于 Pod 或名字空间的 NetworkPolicy 时,
7070
你会使用{{< glossary_tooltip text="选择算符" term_id="selector">}}来设定哪些流量可以进入或离开与该算符匹配的 Pod。
@@ -87,17 +87,17 @@ Creating a NetworkPolicy resource without a controller that implements it will h
8787
创建一个 NetworkPolicy 资源对象而没有控制器来使它生效的话,是没有任何作用的。
8888

8989
<!--
90-
## The Two Sorts of Pod Isolation
90+
## The two Sorts of Pod isolation
9191
9292
There are two sorts of isolation for a pod: isolation for egress, and isolation for ingress.
9393
They concern what connections may be established. "Isolation" here is not absolute, rather it
9494
means "some restrictions apply". The alternative, "non-isolated for $direction", means that no
95-
restrictions apply in the stated direction. The two sorts of isolation (or not) are declared
95+
restrictions apply in the stated direction. The two sorts of isolation (or not) are declared
9696
independently, and are both relevant for a connection from one pod to another.
9797
-->
9898
## Pod 隔离的两种类型 {#the-two-sorts-of-pod-isolation}
9999

100-
Pod 有两种隔离: 出口的隔离和入口的隔离。它们涉及到可以建立哪些连接。
100+
Pod 有两种隔离出口的隔离和入口的隔离。它们涉及到可以建立哪些连接。
101101
这里的“隔离”不是绝对的,而是意味着“有一些限制”。
102102
另外的,“非隔离方向”意味着在所述方向上没有限制。这两种隔离(或不隔离)是独立声明的,
103103
并且都与从一个 Pod 到另一个 Pod 的连接有关。
@@ -112,7 +112,7 @@ allowed connections will also be implicitly allowed.
112112
The effects of those `egress` lists combine additively.
113113
-->
114114
默认情况下,一个 Pod 的出口是非隔离的,即所有外向连接都是被允许的。如果有任何的 NetworkPolicy
115-
选择该 Pod 并在其 `policyTypes` 中包含 Egress,则该 Pod 是出口隔离的,
115+
选择该 Pod 并在其 `policyTypes` 中包含 "Egress",则该 Pod 是出口隔离的,
116116
我们称这样的策略适用于该 Pod 的出口。当一个 Pod 的出口被隔离时,
117117
唯一允许的来自 Pod 的连接是适用于出口的 Pod 的某个 NetworkPolicy 的 `egress` 列表所允许的连接。
118118
针对那些允许连接的应答流量也将被隐式允许。
@@ -176,7 +176,7 @@ solution supports network policy.
176176

177177
<!--
178178
__Mandatory Fields__: As with all other Kubernetes config, a NetworkPolicy needs `apiVersion`,
179-
`kind`, and `metadata` fields. For general information about working with config files, see
179+
`kind`, and `metadata` fields. For general information about working with config files, see
180180
[Configure a Pod to Use a ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/),
181181
and [Object Management](/docs/concepts/overview/working-with-objects/object-management).
182182
@@ -192,7 +192,8 @@ which the policy applies. The example policy selects pods with the label "role=d
192192
请参考[配置 Pod 以使用 ConfigMap](/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/)
193193
[对象管理](/zh-cn/docs/concepts/overview/working-with-objects/object-management)
194194

195-
**spec**:NetworkPolicy [规约](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status)
195+
**spec**:NetworkPolicy
196+
[规约](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status)
196197
中包含了在一个名字空间中定义特定网络策略所需的所有信息。
197198

198199
**podSelector**:每个 NetworkPolicy 都包括一个 `podSelector`
@@ -257,13 +258,13 @@ walkthrough for further examples.
257258

258259
* `default` 名字空间下带有 `role=frontend` 标签的所有 Pod
259260
* 带有 `project=myproject` 标签的所有名字空间中的 Pod
260-
* IP 地址范围为 172.17.0.0–172.17.0.255 和 172.17.2.0–172.17.255.255
261-
(即,除了 172.17.1.0/24 之外的所有 172.17.0.0/16)
261+
* IP 地址范围为 `172.17.0.0–172.17.0.255``172.17.2.0–172.17.255.255`
262+
(即,除了 `172.17.1.0/24` 之外的所有 `172.17.0.0/16`
262263

263264
3. (Egress 规则)允许 `default` 名字空间中任何带有标签 `role=db` 的 Pod 到 CIDR
264-
10.0.0.0/24 下 5978 TCP 端口的连接。
265+
`10.0.0.0/24` 下 5978 TCP 端口的连接。
265266

266-
参阅[声明网络策略](/zh-cn/docs/tasks/administer-cluster/declare-network-policy/)演练了解更多示例
267+
有关更多示例,请参阅[声明网络策略](/zh-cn/docs/tasks/administer-cluster/declare-network-policy/)演练
267268

268269
<!--
269270
## Behavior of `to` and `from` selectors
@@ -393,7 +394,7 @@ You can create a "default" ingress isolation policy for a namespace by creating
393394
that selects all pods but does not allow any ingress traffic to those pods.
394395
-->
395396
你可以通过创建选择所有 Pod 但不允许任何进入这些 Pod 的入站流量的 NetworkPolicy
396-
来为名字空间创建 default 隔离策略。
397+
来为名字空间创建 "default" 隔离策略。
397398

398399
{{< code_sample file="service/networking/network-policy-default-deny-ingress.yaml" >}}
399400

@@ -419,7 +420,7 @@ that explicitly allows that.
419420

420421
<!--
421422
With this policy in place, no additional policy or policies can cause any incoming connection to
422-
those pods to be denied. This policy has no effect on isolation for egress from any pod.
423+
those pods to be denied. This policy has no effect on isolation for egress from any pod.
423424
-->
424425
有了这个策略,任何额外的策略都不会导致到这些 Pod 的任何入站连接被拒绝。
425426
此策略对任何 Pod 的出口隔离没有影响。
@@ -433,7 +434,7 @@ that selects all pods but does not allow any egress traffic from those pods.
433434
### 默认拒绝所有出站流量 {#default-deny-all-egress-traffic}
434435

435436
你可以通过创建选择所有容器但不允许来自这些容器的任何出站流量的 NetworkPolicy
436-
来为名字空间创建 default 隔离策略。
437+
来为名字空间创建 "default" 隔离策略。
437438

438439
{{< code_sample file="service/networking/network-policy-default-deny-egress.yaml" >}}
439440

@@ -460,7 +461,7 @@ explicitly allows all outgoing connections from pods in that namespace.
460461

461462
<!--
462463
With this policy in place, no additional policy or policies can cause any outgoing connection from
463-
those pods to be denied. This policy has no effect on isolation for ingress to any pod.
464+
those pods to be denied. This policy has no effect on isolation for ingress to any pod.
464465
-->
465466
有了这个策略,任何额外的策略都不会导致来自这些 Pod 的任何出站连接被拒绝。
466467
此策略对进入任何 Pod 的隔离没有影响。
@@ -473,7 +474,7 @@ creating the following NetworkPolicy in that namespace.
473474
-->
474475
### 默认拒绝所有入站和所有出站流量 {#default-deny-all-ingress-and-all-egress-traffic}
475476

476-
你可以为名字空间创建 default 策略,以通过在该名字空间中创建以下 NetworkPolicy
477+
你可以为名字空间创建 "default" 策略,以通过在该名字空间中创建以下 NetworkPolicy
477478
来阻止所有入站和出站流量。
478479

479480
{{< code_sample file="service/networking/network-policy-default-deny-all.yaml" >}}
@@ -487,8 +488,8 @@ ingress or egress traffic.
487488
<!--
488489
## Network traffic filtering
489490
490-
NetworkPolicy is defined for [layer 4](https://en.wikipedia.org/wiki/OSI_model#Layer_4:_Transport_layer)
491-
connections (TCP, UDP, and optionally SCTP). For all the other protocols, the behaviour may vary
491+
NetworkPolicy is defined for [layer 4](https://en.wikipedia.org/wiki/OSI_model#Layer_4:_Transport_layer)
492+
connections (TCP, UDP, and optionally SCTP). For all the other protocols, the behaviour may vary
492493
across network plugins.
493494
-->
494495
## 网络流量过滤 {#network-traffic-filtering}
@@ -508,7 +509,7 @@ protocol NetworkPolicies.
508509
When a `deny all` network policy is defined, it is only guaranteed to deny TCP, UDP and SCTP
509510
connections. For other protocols, such as ARP or ICMP, the behaviour is undefined.
510511
The same applies to allow rules: when a specific pod is allowed as ingress source or egress destination,
511-
it is undefined what happens with (for example) ICMP packets. Protocols such as ICMP may be allowed by some
512+
it is undefined what happens with (for example) ICMP packets. Protocols such as ICMP may be allowed by some
512513
network plugins and denied by others.
513514
-->
514515
`deny all` 网络策略被定义时,此策略只能保证拒绝 TCP、UDP 和 SCTP 连接。
@@ -536,8 +537,8 @@ This is achievable with the usage of the `endPort` field, as the following examp
536537
{{< code_sample file="service/networking/networkpolicy-multiport-egress.yaml" >}}
537538

538539
<!--
539-
The above rule allows any Pod with label `role=db` on the namespace `default` to communicate
540-
with any IP within the range `10.0.0.0/24` over TCP, provided that the target
540+
The above rule allows any Pod with label `role=db` on the namespace `default` to communicate
541+
with any IP within the range `10.0.0.0/24` over TCP, provided that the target
541542
port is between the range 32000 and 32768.
542543
-->
543544
上面的规则允许名字空间 `default` 中所有带有标签 `role=db` 的 Pod 使用 TCP 协议与
@@ -560,7 +561,7 @@ The following restrictions apply when using this field:
560561
<!--
561562
Your cluster must be using a {{< glossary_tooltip text="CNI" term_id="cni" >}} plugin that
562563
supports the `endPort` field in NetworkPolicy specifications.
563-
If your [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)
564+
If your [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)
564565
does not support the `endPort` field and you specify a NetworkPolicy with that,
565566
the policy will be applied only for the single `port` field.
566567
-->
@@ -658,7 +659,7 @@ NetworkPolicy.
658659
When a new NetworkPolicy object is created, it may take some time for a network plugin
659660
to handle the new object. If a pod that is affected by a NetworkPolicy
660661
is created before the network plugin has completed NetworkPolicy handling,
661-
that pod may be started unprotected, and isolation rules will be applied when
662+
that pod may be started unprotected, and isolation rules will be applied when
662663
the NetworkPolicy handling is completed.
663664
-->
664665
当新的 NetworkPolicy 对象被创建时,网络插件可能需要一些时间来处理这个新对象。
@@ -669,11 +670,11 @@ the NetworkPolicy handling is completed.
669670
Once the NetworkPolicy is handled by a network plugin,
670671

671672
1. All newly created pods affected by a given NetworkPolicy will be isolated before
672-
they are started.
673-
Implementations of NetworkPolicy must ensure that filtering is effective throughout
674-
the Pod lifecycle, even from the very first instant that any container in that Pod is started.
675-
Because they are applied at Pod level, NetworkPolicies apply equally to init containers,
676-
sidecar containers, and regular containers.
673+
they are started.
674+
Implementations of NetworkPolicy must ensure that filtering is effective throughout
675+
the Pod lifecycle, even from the very first instant that any container in that Pod is started.
676+
Because they are applied at Pod level, NetworkPolicies apply equally to init containers,
677+
sidecar containers, and regular containers.
677678
-->
678679
一旦 NetworkPolicy 被网络插件处理,
679680

@@ -684,8 +685,8 @@ sidecar containers, and regular containers.
684685

685686
<!--
686687
2. Allow rules will be applied eventually after the isolation rules (or may be applied at the same time).
687-
In the worst case, a newly created pod may have no network connectivity at all when it is first started, if
688-
isolation rules were already applied, but no allow rules were applied yet.
688+
In the worst case, a newly created pod may have no network connectivity at all when it is first started, if
689+
isolation rules were already applied, but no allow rules were applied yet.
689690

690691
Every created NetworkPolicy will be handled by a network plugin eventually, but there is no
691692
way to tell from the Kubernetes API when exactly that happens.
@@ -694,11 +695,12 @@ way to tell from the Kubernetes API when exactly that happens.
694695
在最糟的情况下,如果隔离规则已被应用,但 allow 规则尚未被应用,
695696
那么新建的 Pod 在初始启动时可能根本没有网络连接。
696697

697-
用户所创建的每个 NetworkPolicy 最终都会被网络插件处理,但无法使用 Kubernetes API 来获知确切的处理时间。
698+
用户所创建的每个 NetworkPolicy 最终都会被网络插件处理,但无法使用 Kubernetes API
699+
来获知确切的处理时间。
698700

699701
<!--
700702
Therefore, pods must be resilient against being started up with different network
701-
connectivity than expected. If you need to make sure the pod can reach certain destinations
703+
connectivity than expected. If you need to make sure the pod can reach certain destinations
702704
before being started, you can use an [init container](/docs/concepts/workloads/pods/init-containers/)
703705
to wait for those destinations to be reachable before kubelet starts the app containers.
704706
-->
@@ -709,7 +711,7 @@ kubelet 启动应用容器之前等待这些目的地变得可达。
709711

710712
<!--
711713
Every NetworkPolicy will be applied to all selected pods eventually.
712-
Because the network plugin may implement NetworkPolicy in a distributed manner,
714+
Because the network plugin may implement NetworkPolicy in a distributed manner,
713715
it is possible that pods may see a slightly inconsistent view of network policies
714716
when the pod is first created, or when pods or policies change.
715717
For example, a newly-created pod that is supposed to be able to reach both Pod A
@@ -742,9 +744,9 @@ NetworkPolicy behaviour for `hostNetwork` pods is undefined, but it should be li
742744
网络插件还可以像处理 Pod 网络流量一样,对 `hostNetwork` Pod 应用 NetworkPolicy。
743745

744746
<!--
745-
- The network plugin cannot properly distinguish `hostNetwork` pod traffic,
746-
and so it ignores `hostNetwork` pods when matching `podSelector` and `namespaceSelector`.
747-
Traffic to/from `hostNetwork` pods is treated the same as all other traffic to/from the node IP.
747+
- The network plugin cannot properly distinguish `hostNetwork` pod traffic,
748+
and so it ignores `hostNetwork` pods when matching `podSelector` and `namespaceSelector`.
749+
Traffic to/from `hostNetwork` pods is treated the same as all other traffic to/from the node IP.
748750
(This is the most common implementation.)
749751
-->
750752
- 网络插件无法正确辨别 `hostNetwork` Pod 流量,因此在匹配 `podSelector` 和 `namespaceSelector`
@@ -771,9 +773,10 @@ This applies when
771773
```
772774

773775
<!--
774-
2. a `hostNetwork` pod is selected by a `podSelector` or `namespaceSelector` in an `ingress` or `egress` rule.
776+
1. a `hostNetwork` pod is selected by a `podSelector` or `namespaceSelector` in an `ingress` or `egress` rule.
775777
-->
776-
2. `hostNetwork` Pod 在 `ingress` 或 `egress` 规则中被 `podSelector` 或 `namespaceSelector` 选中。
778+
2. `hostNetwork` Pod 在 `ingress` 或 `egress` 规则中被 `podSelector` 或
779+
`namespaceSelector` 选中。
777780

778781
```yaml
779782
...
@@ -799,7 +802,7 @@ from a `hostNetwork` Pod using an `ipBlock` rule.
799802
As of Kubernetes {{< skew currentVersion >}}, the following functionality does not exist in the
800803
NetworkPolicy API, but you might be able to implement workarounds using Operating System
801804
components (such as SELinux, OpenVSwitch, IPTables, and so on) or Layer 7 technologies (Ingress
802-
controllers, Service Mesh implementations) or admission controllers. In case you are new to
805+
controllers, Service Mesh implementations) or admission controllers. In case you are new to
803806
network security in Kubernetes, its worth noting that the following User Stories cannot (yet) be
804807
implemented using the NetworkPolicy API.
805808
-->
@@ -873,6 +876,6 @@ It is recommended not to modify policies/pods/namespaces in ways that might affe
873876
- See more [recipes](https://github.com/ahmetb/kubernetes-network-policy-recipes) for common
874877
scenarios enabled by the NetworkPolicy resource.
875878
-->
876-
- 参阅[声明网络策略](/zh-cn/docs/tasks/administer-cluster/declare-network-policy/)演练了解更多示例;
879+
- 有关更多示例,请参阅[声明网络策略](/zh-cn/docs/tasks/administer-cluster/declare-network-policy/)演练。
877880
- 有关 NetworkPolicy 资源所支持的常见场景的更多信息,
878881
请参见[此指南](https://github.com/ahmetb/kubernetes-network-policy-recipes)。

content/zh-cn/releases/patch-releases.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if there are questions on the PR.
5555

5656
在两次发布之间,团队每周都会查看收到的 cherry pick 请求。
5757
如果对 PR 有任何问题,团队将通过 GitHub PR、Slack 中的 SIG 频道以及 Slack 中的直接消息和
58-
[email](mailto:[email protected]) 与提交者取得联系。
58+
[Email](mailto:[email protected]) 与提交者取得联系。
5959

6060
<!--
6161
## Cherry picks
@@ -149,17 +149,15 @@ releases may also occur in between these.
149149
<!--
150150
| Monthly Patch Release | Cherry Pick Deadline | Target date |
151151
| --------------------- | -------------------- | ----------- |
152-
| December 2023 | 2023-12-15 | 2023-12-19 |
153-
| January 2024 | 2024-01-12 | 2024-01-17 |
154-
| February 2024 | 2024-02-09 | 2024-02-14 |
155152
| March 2024 | 2024-03-08 | 2024-03-13 |
153+
| April 2024 | 2024-04-12 | 2024-04-17 |
154+
| May 2024 | 2024-05-10 | 2024-05-15 |
156155
-->
157156
| 月度补丁发布 | Cherry Pick 截止日期 | 目标日期 |
158157
|--------------|---------------------|-------------|
159-
| 2023 年 12 月 | 2023-12-15 | 2023-12-19 |
160-
| 2024 年 1 月 | 2024-01-12 | 2024-01-17 |
161-
| 2024 年 2 月 | 2024-02-09 | 2024-02-14 |
162158
| 2024 年 3 月 | 2024-03-08 | 2024-03-13 |
159+
| 2024 年 4 月 | 2024-04-12 | 2024-04-17 |
160+
| 2024 年 5 月 | 2024-05-10 | 2024-05-15 |
163161

164162
<!--
165163
## Detailed Release History for Active Branches

0 commit comments

Comments
 (0)