Skip to content

Commit 4af53e7

Browse files
authored
Merge pull request #38156 from windsonsea/netplu
[zh] sync network-plugins.md
2 parents a933ac0 + d822919 commit 4af53e7

File tree

1 file changed

+56
-28
lines changed

1 file changed

+56
-28
lines changed

content/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ content_type: concept
44
weight: 10
55
---
66
<!--
7+
reviewers:
8+
- dcbw
9+
- freehan
10+
- thockin
711
title: Network Plugins
812
content_type: concept
913
weight: 10
@@ -13,14 +17,17 @@ weight: 10
1317

1418
<!--
1519
Kubernetes {{< skew currentVersion >}} supports [Container Network Interface](http://github.com/containernetworking/cni)
16-
(CNI) plugins for cluster networking. You must use a CNI plugin that is compatible with your cluster and that suits your needs. Different plugins are available (both open- and closed- source) in the wider Kubernetes ecosystem.
20+
(CNI) plugins for cluster networking. You must use a CNI plugin that is compatible with your
21+
cluster and that suits your needs. Different plugins are available (both open- and closed- source)
22+
in the wider Kubernetes ecosystem.
1723
-->
1824
Kubernetes {{< skew currentVersion >}} 支持用于集群联网的[容器网络接口](http://github.com/containernetworking/cni) (CNI) 插件。
1925
你必须使用和你的集群相兼容并且满足你的需求的 CNI 插件。
2026
在更广泛的 Kubernetes 生态系统中你可以使用不同的插件(开源和闭源)。
2127

2228
<!--
23-
A CNI plugin is required to implement the [Kubernetes network model](/docs/concepts/services-networking/#the-kubernetes-network-model).
29+
A CNI plugin is required to implement the
30+
[Kubernetes network model](/docs/concepts/services-networking/#the-kubernetes-network-model).
2431
-->
2532
要实现 [Kubernetes 网络模型](/zh-cn/docs/concepts/services-networking/#the-kubernetes-network-model),你需要一个 CNI 插件。
2633

@@ -29,7 +36,7 @@ You must use a CNI plugin that is compatible with the
2936
[v0.4.0](http://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md) or later
3037
releases of the CNI specification. The Kubernetes project recommends using a plugin that is
3138
compatible with the [v1.0.0](http://github.com/containernetworking/cni/blob/spec-v1.0.0/SPEC.md)
32-
CNI specification (plugins can be compatible with multiple spec versions).
39+
CNI specification (plugins can be compatible with multiple spec versions).
3340
-->
3441
你必须使用与 [v0.4.0](http://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md)
3542
或更高版本的 CNI 规范相符合的 CNI 插件。
@@ -41,7 +48,9 @@ CNI 规范的插件(插件可以兼容多个规范版本)。
4148
<!--
4249
## Installation
4350
44-
A Container Runtime, in the networking context, is a daemon on a node configured to provide CRI Services for kubelet. In particular, the Container Runtime must be configured to load the CNI plugins required to implement the Kubernetes network model.
51+
A Container Runtime, in the networking context, is a daemon on a node configured to provide CRI
52+
Services for kubelet. In particular, the Container Runtime must be configured to load the CNI
53+
plugins required to implement the Kubernetes network model.
4554
-->
4655
## 安装 {#installation}
4756

@@ -51,8 +60,10 @@ CNI 插件,从而实现 Kubernetes 网络模型。
5160

5261
{{< note >}}
5362
<!--
54-
Prior to Kubernetes 1.24, the CNI plugins could also be managed by the kubelet using the `cni-bin-dir` and `network-plugin` command-line parameters.
55-
These command-line parameters were removed in Kubernetes 1.24, with management of the CNI no longer in scope for kubelet.
63+
Prior to Kubernetes 1.24, the CNI plugins could also be managed by the kubelet using the
64+
`cni-bin-dir` and `network-plugin` command-line parameters.
65+
These command-line parameters were removed in Kubernetes 1.24, with management of the CNI no
66+
longer in scope for kubelet.
5667
-->
5768
在 Kubernetes 1.24 之前,CNI 插件也可以由 kubelet 使用命令行参数 `cni-bin-dir`
5869
`network-plugin` 管理。Kubernetes 1.24 移除了这些命令行参数,
@@ -62,19 +73,22 @@ CNI 的管理不再是 kubelet 的工作。
6273
See [Troubleshooting CNI plugin-related errors](/docs/tasks/administer-cluster/migrating-from-dockershim/troubleshooting-cni-plugin-related-errors/)
6374
if you are facing issues following the removal of dockershim.
6475
-->
65-
如果你在移除 dockershim 之后遇到问题,请参阅[排查 CNI 插件相关的错误](/zh-cn/docs/tasks/administer-cluster/migrating-from-dockershim/troubleshooting-cni-plugin-related-errors/)
76+
如果你在移除 dockershim 之后遇到问题,
77+
请参阅[排查 CNI 插件相关的错误](/zh-cn/docs/tasks/administer-cluster/migrating-from-dockershim/troubleshooting-cni-plugin-related-errors/)
6678
{{< /note >}}
6779

6880
<!--
69-
For specific information about how a Container Runtime manages the CNI plugins, see the documentation for that Container Runtime, for example:
81+
For specific information about how a Container Runtime manages the CNI plugins, see the
82+
documentation for that Container Runtime, for example:
7083
-->
7184
要了解容器运行时如何管理 CNI 插件的具体信息,可参见对应容器运行时的文档,例如:
7285

7386
- [containerd](http://github.com/containerd/containerd/blob/main/script/setup/install-cni)
7487
- [CRI-O](http://github.com/cri-o/cri-o/blob/main/contrib/cni/README.md)
7588

7689
<!--
77-
For specific information about how to install and manage a CNI plugin, see the documentation for that plugin or [networking provider](/docs/concepts/cluster-administration/networking/#how-to-implement-the-kubernetes-networking-model).
90+
For specific information about how to install and manage a CNI plugin, see the documentation for
91+
that plugin or [networking provider](/docs/concepts/cluster-administration/networking/#how-to-implement-the-kubernetes-networking-model).
7892
-->
7993
要了解如何安装和管理 CNI 插件的具体信息,可参阅对应的插件或
8094
[网络驱动(Networking Provider)](/zh-cn/docs/concepts/cluster-administration/networking/#how-to-implement-the-kubernetes-networking-model)
@@ -83,10 +97,14 @@ For specific information about how to install and manage a CNI plugin, see the d
8397
<!--
8498
## Network Plugin Requirements
8599
86-
For plugin developers and users who regularly build or deploy Kubernetes, the plugin may also need specific configuration to support kube-proxy.
87-
The iptables proxy depends on iptables, and the plugin may need to ensure that container traffic is made available to iptables.
88-
For example, if the plugin connects containers to a Linux bridge, the plugin must set the `net/bridge/bridge-nf-call-iptables` sysctl to `1` to ensure that the iptables proxy functions correctly.
89-
If the plugin does not use a Linux bridge, but uses something like Open vSwitch or some other mechanism instead, it should ensure container traffic is appropriately routed for the proxy.
100+
For plugin developers and users who regularly build or deploy Kubernetes, the plugin may also need
101+
specific configuration to support kube-proxy. The iptables proxy depends on iptables, and the
102+
plugin may need to ensure that container traffic is made available to iptables. For example, if
103+
the plugin connects containers to a Linux bridge, the plugin must set the
104+
`net/bridge/bridge-nf-call-iptables` sysctl to `1` to ensure that the iptables proxy functions
105+
correctly. If the plugin does not use a Linux bridge, but uses something like Open vSwitch or
106+
some other mechanism instead, it should ensure container traffic is appropriately routed for the
107+
proxy.
90108
-->
91109
## 网络插件要求 {#network-plugin-requirements}
92110

@@ -99,18 +117,24 @@ sysctl 参数设置为 `1`,以确保 iptables 代理正常工作。
99117
它应该确保为代理对容器通信执行正确的路由。
100118

101119
<!--
102-
By default if no kubelet network plugin is specified, the `noop` plugin is used, which sets `net/bridge/bridge-nf-call-iptables=1` to ensure simple configurations (like Docker with a bridge) work correctly with the iptables proxy.
120+
By default, if no kubelet network plugin is specified, the `noop` plugin is used, which sets
121+
`net/bridge/bridge-nf-call-iptables=1` to ensure simple configurations (like Docker with a bridge)
122+
work correctly with the iptables proxy.
103123
-->
104-
105124
默认情况下,如果未指定 kubelet 网络插件,则使用 `noop` 插件,
106125
该插件设置 `net/bridge/bridge-nf-call-iptables=1`,以确保简单的配置
107126
(如带网桥的 Docker )与 iptables 代理正常工作。
108127

109128
<!--
110129
### Loopback CNI
111130
112-
In addition to the CNI plugin installed on the nodes for implementing the Kubernetes network model, Kubernetes also requires the container runtimes to provide a loopback interface `lo`, which is used for each sandbox (pod sandboxes, vm sandboxes, ...).
113-
Implementing the loopback interface can be accomplished by re-using the [CNI loopback plugin.](http://github.com/containernetworking/plugins/blob/master/plugins/main/loopback/loopback.go) or by developing your own code to achieve this (see [this example from CRI-O](http://github.com/cri-o/ocicni/blob/release-1.24/pkg/ocicni/util_linux.go#L91)).
131+
In addition to the CNI plugin installed on the nodes for implementing the Kubernetes network
132+
model, Kubernetes also requires the container runtimes to provide a loopback interface `lo`, which
133+
is used for each sandbox (pod sandboxes, vm sandboxes, ...).
134+
Implementing the loopback interface can be accomplished by re-using the
135+
[CNI loopback plugin.](http://github.com/containernetworking/plugins/blob/master/plugins/main/loopback/loopback.go)
136+
or by developing your own code to achieve this (see
137+
[this example from CRI-O](http://github.com/cri-o/ocicni/blob/release-1.24/pkg/ocicni/util_linux.go#L91)).
114138
-->
115139
### 本地回路 CNI {#loopback-cni}
116140

@@ -124,15 +148,16 @@ Implementing the loopback interface can be accomplished by re-using the [CNI loo
124148
<!--
125149
### Support hostPort
126150
127-
The CNI networking plugin supports `hostPort`. You can use the official [portmap](http://github.com/containernetworking/plugins/tree/master/plugins/meta/portmap)
151+
The CNI networking plugin supports `hostPort`. You can use the official
152+
[portmap](http://github.com/containernetworking/plugins/tree/master/plugins/meta/portmap)
128153
plugin offered by the CNI plugin team or use your own plugin with portMapping functionality.
129154
130-
If you want to enable `hostPort` support, you must specify `portMappings capability` in your `cni-conf-dir`.
131-
For example:
155+
If you want to enable `hostPort` support, you must specify `portMappings capability` in your
156+
`cni-conf-dir`. For example:
132157
-->
133158
### 支持 hostPort {#support-hostport}
134159

135-
CNI 网络插件支持 `hostPort` 你可以使用官方
160+
CNI 网络插件支持 `hostPort`。你可以使用官方
136161
[portmap](http://github.com/containernetworking/plugins/tree/master/plugins/meta/portmap)
137162
插件,它由 CNI 插件团队提供,或者使用你自己的带有 portMapping 功能的插件。
138163

@@ -173,17 +198,19 @@ CNI 网络插件支持 `hostPort`。 你可以使用官方
173198
174199
**Experimental Feature**
175200
176-
The CNI networking plugin also supports pod ingress and egress traffic shaping. You can use the official [bandwidth](http://github.com/containernetworking/plugins/tree/master/plugins/meta/bandwidth)
201+
The CNI networking plugin also supports pod ingress and egress traffic shaping. You can use the
202+
official [bandwidth](http://github.com/containernetworking/plugins/tree/master/plugins/meta/bandwidth)
177203
plugin offered by the CNI plugin team or use your own plugin with bandwidth control functionality.
178204
179-
If you want to enable traffic shaping support, you must add the `bandwidth` plugin to your CNI configuration file
180-
(default `/etc/cni/net.d`) and ensure that the binary is included in your CNI bin dir (default `/opt/cni/bin`).
205+
If you want to enable traffic shaping support, you must add the `bandwidth` plugin to your CNI
206+
configuration file (default `/etc/cni/net.d`) and ensure that the binary is included in your CNI
207+
bin dir (default `/opt/cni/bin`).
181208
-->
182209
### 支持流量整形 {#support-traffic-shaping}
183210

184211
**实验功能**
185212

186-
CNI 网络插件还支持 pod 入口和出口流量整形
213+
CNI 网络插件还支持 Pod 入站和出站流量整形
187214
你可以使用 CNI 插件团队提供的
188215
[bandwidth](http://github.com/containernetworking/plugins/tree/master/plugins/meta/bandwidth)
189216
插件,也可以使用你自己的具有带宽控制功能的插件。
@@ -220,12 +247,13 @@ CNI 网络插件还支持 pod 入口和出口流量整形。
220247
]
221248
}
222249
```
250+
223251
<!--
224-
Now you can add the `kubernetes.io/ingress-bandwidth` and `kubernetes.io/egress-bandwidth` annotations to your pod.
225-
For example:
252+
Now you can add the `kubernetes.io/ingress-bandwidth` and `kubernetes.io/egress-bandwidth`
253+
annotations to your Pod. For example:
226254
-->
227255
现在,你可以将 `kubernetes.io/ingress-bandwidth``kubernetes.io/egress-bandwidth`
228-
注解添加到 pod 中。例如:
256+
注解添加到 Pod 中。例如:
229257

230258
```yaml
231259
apiVersion: v1

0 commit comments

Comments
 (0)