Skip to content

Commit b5666b3

Browse files
authored
Merge pull request #38418 from gaogao101/work52
[zh-cn] sync service-traffic-policy.md
2 parents e91bb40 + 1ef1184 commit b5666b3

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

content/zh-cn/docs/concepts/services-networking/service-traffic-policy.md

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 服务内部流量策略
33
content_type: concept
4-
weight: 75
4+
weight: 120
55
description: >-
66
如果集群中的两个 Pod 想要通信,并且两个 Pod 实际上都在同一节点运行,
77
**服务内部流量策略** 可以将网络流量限制在该节点内。
@@ -13,7 +13,7 @@ reviewers:
1313
- maplain
1414
title: Service Internal Traffic Policy
1515
content_type: concept
16-
weight: 75
16+
weight: 120
1717
description: >-
1818
If two Pods in your cluster want to communicate, and both Pods are actually running on
1919
the same node, _Service Internal Traffic Policy_ to keep network traffic within that node.
@@ -24,7 +24,7 @@ description: >-
2424

2525
<!-- overview -->
2626

27-
{{< feature-state for_k8s_version="v1.23" state="beta" >}}
27+
{{< feature-state for_k8s_version="v1.26" state="stable" >}}
2828

2929
<!--
3030
_Service Internal Traffic Policy_ enables internal traffic restrictions to only route
@@ -43,20 +43,16 @@ cluster. This can help to reduce costs and improve performance.
4343
-->
4444
## 使用服务内部流量策略 {#using-service-internal-traffic-policy}
4545

46-
<!--
47-
The `ServiceInternalTrafficPolicy` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
48-
is a Beta feature and enabled by default.
49-
When the feature is enabled, you can enable the internal-only traffic policy for a
46+
<!--
47+
You can enable the internal-only traffic policy for a
5048
{{< glossary_tooltip text="Service" term_id="service" >}}, by setting its
51-
`.spec.internalTrafficPolicy` to `Local`.
52-
This tells kube-proxy to only use node local endpoints for cluster internal traffic.
49+
`.spec.internalTrafficPolicy` to `Local`. This tells kube-proxy to only use node local
50+
endpoints for cluster internal traffic.
5351
-->
54-
`ServiceInternalTrafficPolicy`
55-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/) 是 Beta 功能,默认启用。
56-
启用该功能后,你就可以通过将 {{< glossary_tooltip text="Service" term_id="service" >}} 的
52+
你可以通过将 {{< glossary_tooltip text="Service" term_id="service" >}} 的
5753
`.spec.internalTrafficPolicy` 项设置为 `Local`
5854
来为它指定一个内部专用的流量策略。
59-
此设置就相当于告诉 kube-proxy 对于集群内部流量只能使用本地的服务端口
55+
此设置就相当于告诉 kube-proxy 对于集群内部流量只能使用节点本地的服务端口
6056

6157
<!--
6258
For pods on nodes with no endpoints for a given Service, the Service
@@ -97,28 +93,23 @@ spec:
9793
-->
9894
## 工作原理 {#how-it-works}
9995
100-
<!--
96+
<!--
10197
The kube-proxy filters the endpoints it routes to based on the
10298
`spec.internalTrafficPolicy` setting. When it's set to `Local`, only node local
103-
endpoints are considered. When it's `Cluster` or missing, all endpoints are
104-
considered.
105-
When the [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
106-
`ServiceInternalTrafficPolicy` is enabled, `spec.internalTrafficPolicy` defaults to "Cluster".
99+
endpoints are considered. When it's `Cluster` (the default), or is not set,
100+
Kubernetes considers all endpoints.
107101
-->
108102
kube-proxy 基于 `spec.internalTrafficPolicy` 的设置来过滤路由的目标服务端点。
109-
当它的值设为 `Local` 时,只选择节点本地的服务端点。
110-
当它的值设为 `Cluster` 或缺省时,则选择所有的服务端点。
111-
启用[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
112-
`ServiceInternalTrafficPolicy` 后,
113-
`spec.internalTrafficPolicy` 的值默认设为 `Cluster`。
103+
当它的值设为 `Local` 时,只会选择节点本地的服务端点。
104+
当它的值设为 `Cluster` 或缺省时,Kubernetes 会选择所有的服务端点。
114105

115106
## {{% heading "whatsnext" %}}
116107

117108
<!--
118109
* Read about [Topology Aware Hints](/docs/concepts/services-networking/topology-aware-hints)
119110
* Read about [Service External Traffic Policy](/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip)
120-
* Read [Connecting Applications with Services](/docs/concepts/services-networking/connect-applications-service/)
111+
* Follow the [Connecting Applications with Services](/docs/tutorials/services/connect-applications-service/) tutorial
121112
-->
122113
* 请阅读[拓扑感知提示](/zh-cn/docs/concepts/services-networking/topology-aware-hints)
123114
* 请阅读 [Service 的外部流量策略](/zh-cn/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip)
124-
* 请阅读[用 Service 连接应用](/zh-cn/docs/concepts/services-networking/connect-applications-service/)
115+
* 遵循[使用 Service 连接到应用](/zh-cn/docs/tutorials/services/connect-applications-service/)教程

0 commit comments

Comments
 (0)