@@ -36,16 +36,16 @@ cluster's pod [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routin
36
36
范围之外的目的地时使用。
37
37
38
38
<!--
39
- ### ** Key Terms**
39
+ ### Key Terms
40
40
-->
41
- ### ** 关键术语** {#key-terms}
41
+ ### 关键术语 {#key-terms}
42
42
43
43
<!--
44
- * **NAT (Network Address Translation)**
44
+ * **NAT (Network Address Translation)**:
45
45
Is a method of remapping one IP address to another by modifying either the source and/or
46
46
destination address information in the IP header. Typically performed by a device doing IP routing.
47
47
-->
48
- * ** NAT ( 网络地址转换) **
48
+ * ** NAT( 网络地址转换) ** :
49
49
是一种通过修改 IP 地址头中的源和/或目标地址信息将一个 IP 地址重新映射
50
50
到另一个 IP 地址的方法。通常由执行 IP 路由的设备执行。
51
51
@@ -55,7 +55,7 @@ cluster's pod [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routin
55
55
multiple source IP addresses are masked behind a single address, which is typically the
56
56
device doing the IP routing. In Kubernetes this is the Node's IP address.
57
57
-->
58
- * ** 伪装**
58
+ * ** 伪装** :
59
59
NAT 的一种形式,通常用于执行多对一地址转换,其中多个源 IP 地址被隐藏在
60
60
单个地址后面,该地址通常是执行 IP 路由的设备。在 Kubernetes 中,
61
61
这是节点的 IP 地址。
@@ -67,18 +67,18 @@ cluster's pod [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routin
67
67
**CIDR notation**, in which an address or routing prefix is written with a suffix indicating
68
68
the number of bits of the prefix, such as 192.168.2.0/24.
69
69
-->
70
- * ** CIDR ( 无类别域间路由) **
70
+ * ** CIDR( 无类别域间路由) ** :
71
71
基于可变长度子网掩码,允许指定任意长度的前缀。
72
- CIDR 引入了一种新的 IP 地址表示方法,现在通常称为** CIDR表示法 ** ,
72
+ CIDR 引入了一种新的 IP 地址表示方法,现在通常称为 ** CIDR 表示法 ** ,
73
73
其中地址或路由前缀后添加一个后缀,用来表示前缀的位数,例如 192.168.2.0/24。
74
74
75
75
<!--
76
- * ** Link Local**
76
+ * Link Local
77
77
A link-local address is a network address that is valid only for communications within the
78
78
network segment or the broadcast domain that the host is connected to. Link-local addresses
79
79
for IPv4 are defined in the address block 169.254.0.0/16 in CIDR notation.
80
80
-->
81
- * ** 本地链路**
81
+ * ** 本地链路** :
82
82
本地链路是仅对网段或主机所连接的广播域内的通信有效的网络地址。
83
83
IPv4 的本地链路地址在 CIDR 表示法的地址块 169.254.0.0/16 中定义。
84
84
@@ -98,19 +98,19 @@ The agent will also treat link-local (169.254.0.0/16) as a non-masquerade CIDR b
98
98
The agent is configured to reload its configuration from the location
99
99
*/etc/config/ip-masq-agent* every 60 seconds, which is also configurable.
100
100
-->
101
- ip-masq-agent 配置 iptables 规则,以便在将流量发送到集群节点的 IP 和集群 IP 范围之外的目标时
102
- 处理伪装节点或 Pod 的 IP 地址。这本质上隐藏了集群节点 IP 地址后面的 Pod IP 地址。
103
- 在某些环境中,去往“外部” 地址的流量必须从已知的机器地址发出。
101
+ ip-masq-agent 配置 iptables 规则,以便在将流量发送到集群节点的 IP 和集群 IP
102
+ 范围之外的目标时处理伪装节点或 Pod 的 IP 地址。这本质上隐藏了集群节点 IP 地址后面的
103
+ Pod IP 地址。 在某些环境中,去往"外部" 地址的流量必须从已知的机器地址发出。
104
104
例如,在 Google Cloud 中,任何到互联网的流量都必须来自 VM 的 IP。
105
105
使用容器时,如 Google Kubernetes Engine,从 Pod IP 发出的流量将被拒绝出站。
106
- 为了避免这种情况,我们必须将 Pod IP 隐藏在 VM 自己的 IP 地址后面 - 通常称为“伪装” 。
106
+ 为了避免这种情况,我们必须将 Pod IP 隐藏在 VM 自己的 IP 地址后面 - 通常称为"伪装" 。
107
107
默认情况下,代理配置为将
108
108
[ RFC 1918] ( https://tools.ietf.org/html/rfc1918 )
109
109
指定的三个私有 IP 范围视为非伪装
110
110
[ 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 ) 。
111
- 这些范围是 10.0.0.0/8, 172.16.0.0/12 和 192.168.0.0/16。
111
+ 这些范围是 10.0.0.0/8、 172.16.0.0/12 和 192.168.0.0/16。
112
112
默认情况下,代理还将链路本地地址(169.254.0.0/16)视为非伪装 CIDR。
113
- 代理程序配置为每隔 60 秒从 * /etc/config/ip-masq-agent* 重新加载其配置,
113
+ 代理程序配置为每隔 60 秒从 ** /etc/config/ip-masq-agent* * 重新加载其配置,
114
114
这也是可修改的。
115
115
116
116
![ masq/non-masq example] ( /images/docs/ip-masq.png )
@@ -134,8 +134,8 @@ optional keys:
134
134
* `masqLinkLocal`: A Boolean (true/false) which indicates whether to masquerade traffic to the
135
135
link local prefix `169.254.0.0/16`. False by default.
136
136
-->
137
- * ` masqLinkLocal ` :布尔值 ( true/false) ,表示是否为本地链路前缀 169.254.0.0/16 的流量提供伪装。
138
- 默认为 false。
137
+ * ` masqLinkLocal ` :布尔值( true/false) ,表示是否为本地链路前缀 ` 169.254.0.0/16 `
138
+ 的流量提供伪装。 默认为 false。
139
139
140
140
<!--
141
141
* `resyncInterval`: A time interval at which the agent attempts to reload config from disk.
@@ -146,7 +146,7 @@ optional keys:
146
146
147
147
<!--
148
148
Traffic to 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 ranges will NOT be masqueraded. Any
149
- other traffic (assumed to be internet) will be masqueraded. An example of a local destination
149
+ other traffic (assumed to be internet) will be masqueraded. An example of a local destination
150
150
from a pod could be its Node's IP address as well as another node's address or one of the IP
151
151
addresses in Cluster's IP range. Any other traffic will be masqueraded by default. The
152
152
below entries show the default set of rules that are applied by the ip-masq-agent:
@@ -180,17 +180,19 @@ to your cluster.
180
180
或者你使用的集群 CIDR 不在 10.0.0.0/8 范围内,
181
181
则 ` ip-masq-agent ` 将在你的集群中运行。
182
182
如果你在其他环境中运行,可以将 ` ip-masq-agent `
183
- [ DaemonSet] ( /zh-cn/docs/concepts/workloads/controllers/daemonset/ ) 添加到你的集群中。
183
+ [ DaemonSet] ( /zh-cn/docs/concepts/workloads/controllers/daemonset/ )
184
+ 添加到你的集群中。
184
185
185
186
<!-- steps -->
186
187
187
188
<!--
188
189
## Create an ip-masq-agent
190
+
189
191
To create an ip-masq-agent, run the following kubectl command:
190
192
-->
191
193
## 创建 ip-masq-agent {#create-ip-masq-agent}
192
194
193
- 通过运行以下 kubectl 指令创建 ip-masq-agent:
195
+ 通过运行以下 kubectl 指令创建 ip-masq-agent:
194
196
195
197
``` shell
196
198
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/ip-masq-agent/master/ip-masq-agent.yaml
@@ -207,31 +209,31 @@ kubectl label nodes my-node node.kubernetes.io/masq-agent-ds-ready=true
207
209
```
208
210
209
211
<!--
210
- More information can be found in the ip-masq-agent documentation [here](https://github.com/kubernetes-sigs/ip-masq-agent)
212
+ More information can be found in the ip-masq-agent documentation [here](https://github.com/kubernetes-sigs/ip-masq-agent).
211
213
-->
212
214
更多信息可以通过 ip-masq-agent 文档[ 这里] ( https://github.com/kubernetes-sigs/ip-masq-agent ) 找到。
213
215
214
216
<!--
215
217
In most cases, the default set of rules should be sufficient; however, if this is not the case
216
218
for your cluster, you can create and apply a
217
219
[ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) to customize the IP
218
- ranges that are affected. For example, to allow
220
+ ranges that are affected. For example, to allow
219
221
only 10.0.0.0/8 to be considered by the ip-masq-agent, you can create the following
220
222
[ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) in a file called
221
223
"config".
222
224
-->
223
225
在大多数情况下,默认的规则集应该足够;但是,如果你的集群不是这种情况,则可以创建并应用
224
226
[ ConfigMap] ( /zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/ )
225
227
来自定义受影响的 IP 范围。
226
- 例如,要允许 ip-masq-agent 仅作用于 10.0.0.0/8,你可以在一个名为 “ config” 的文件中创建以下
227
- [ ConfigMap] ( /zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/ ) 。
228
+ 例如,要允许 ip-masq-agent 仅作用于 10.0.0.0/8,你可以在一个名为 " config" 的文件中创建以下
229
+ [ ConfigMap] ( /zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/ ) 。
228
230
229
231
{{< note >}}
230
232
<!--
231
233
It is important that the file is called config since, by default, that will be used as the key
232
234
for lookup by the `ip-masq-agent`:
233
235
-->
234
- 重要的是,该文件之所以被称为 config,因为默认情况下 ,该文件将被用作
236
+ 重要的是,该文件之所以被称为 config,是因为默认情况下 ,该文件将被用作
235
237
` ip-masq-agent ` 查找的主键:
236
238
237
239
``` yaml
@@ -242,7 +244,7 @@ resyncInterval: 60s
242
244
{{< /note >}}
243
245
244
246
<!--
245
- Run the following command to add the config map to your cluster:
247
+ Run the following command to add the configmap to your cluster:
246
248
-->
247
249
运行以下命令将 ConfigMap 添加到你的集群:
248
250
@@ -276,8 +278,8 @@ By default, the link local range (169.254.0.0/16) is also handled by the ip-masq
276
278
sets up the appropriate iptables rules. To have the ip-masq-agent ignore link local, you can
277
279
set `masqLinkLocal` to true in the ConfigMap.
278
280
-->
279
- 默认情况下,本地链路范围 ( 169.254.0.0/16) 也由 ip-masq agent 处理,
280
- 该代理设置适当的 iptables 规则。 要使 ip-masq-agent 忽略本地链路,
281
+ 默认情况下,本地链路范围( 169.254.0.0/16) 也由 ip-masq agent 处理,
282
+ 该代理设置适当的 iptables 规则。要使 ip-masq-agent 忽略本地链路,
281
283
可以在 ConfigMap 中将 ` masqLinkLocal ` 设置为 true。
282
284
283
285
``` yaml
0 commit comments