[zh] Tidy up and fix links in tasks section (6/10)
This commit is contained in:
@@ -3,10 +3,8 @@ title: IP Masquerade Agent 用户指南
|
||||
content_type: task
|
||||
---
|
||||
<!--
|
||||
---
|
||||
title: IP Masquerade Agent User Guide
|
||||
content_type: task
|
||||
---
|
||||
-->
|
||||
|
||||
<!-- overview -->
|
||||
@@ -15,14 +13,10 @@ This page shows how to configure and enable the ip-masq-agent.
|
||||
-->
|
||||
此页面展示如何配置和启用 ip-masq-agent。
|
||||
|
||||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
|
||||
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
|
||||
|
||||
|
||||
|
||||
<!-- discussion -->
|
||||
<!--
|
||||
## IP Masquerade Agent User Guide
|
||||
@@ -37,7 +31,7 @@ ip-masq-agent 配置 iptables 规则以隐藏位于集群节点 IP 地址后面
|
||||
<!--
|
||||
### **Key Terms**
|
||||
-->
|
||||
### **关键词**
|
||||
### **关键术语**
|
||||
|
||||
<!--
|
||||
* **NAT (Network Address Translation)**
|
||||
@@ -70,7 +64,17 @@ ip-masq-agent 配置 iptables 规则以隐藏位于集群节点 IP 地址后面
|
||||
<!--
|
||||
The ip-masq-agent configures iptables rules to handle masquerading node/pod IP addresses when sending traffic to destinations outside the cluster node's IP and the Cluster IP range. This essentially hides pod IP addresses behind the cluster node's IP address. In some environments, traffic to "external" addresses must come from a known machine address. For example, in Google Cloud, any traffic to the internet must come from a VM's IP. When containers are used, as in Google Kubernetes Engine, the Pod IP will be rejected for egress. To avoid this, we must hide the Pod IP behind the VM's own IP address - generally known as "masquerade". By default, the agent is configured to treat the three private IP ranges specified by [RFC 1918](https://tools.ietf.org/html/rfc1918) as non-masquerade [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). These ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. The agent will also treat link-local (169.254.0.0/16) as a non-masquerade CIDR by default. The agent is configured to reload its configuration from the location */etc/config/ip-masq-agent* every 60 seconds, which is also configurable.
|
||||
-->
|
||||
ip-masq-agent 配置 iptables 规则,以便在将流量发送到集群节点的IP和集群IP范围之外的目标时处理伪装节点/pod 的 IP 地址。这基本上隐藏了集群节点 IP 地址后面的pod IP地址。在某些环境中,去往“外部”地址的流量必须从已知的机器地址发出。例如,在 Google Cloud 中,任何到互联网的流量都必须来自 VM 的 IP。使用容器时,如 Google Kubernetes Engine,从Pod IP 发出的流量将被拒绝出出站。为了避免这种情况,我们必须将 Pod IP 隐藏在 VM 自己的IP地址后面 - 通常称为“伪装”。默认情况下,代理配置为将[RFC 1918](https://tools.ietf.org/html/rfc1918)指定的三个私有IP范围视为非伪装[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)。这些范围是 10.0.0.0/8,172.16.0.0/12 和 192.168.0.0/16。默认情况下,代理还将链路本地地址(169.254.0.0/16)视为非伪装 CIDR。代理程序配置为每隔60秒从*/etc/config/ip-masq-agent*重新加载其配置,这也是可修改的。
|
||||
ip-masq-agent 配置 iptables 规则,以便在将流量发送到集群节点的 IP 和集群 IP 范围之外的目标时
|
||||
处理伪装节点/Pod 的 IP 地址。这基本上隐藏了集群节点 IP 地址后面的 Pod IP 地址。
|
||||
在某些环境中,去往“外部”地址的流量必须从已知的机器地址发出。
|
||||
例如,在 Google Cloud 中,任何到互联网的流量都必须来自 VM 的 IP。
|
||||
使用容器时,如 Google Kubernetes Engine,从 Pod IP 发出的流量将被拒绝出站。
|
||||
为了避免这种情况,我们必须将 Pod IP 隐藏在 VM 自己的 IP 地址后面 - 通常称为“伪装”。
|
||||
默认情况下,代理配置为将[RFC 1918](https://tools.ietf.org/html/rfc1918)指定的三个私有
|
||||
IP 范围视为非伪装 [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)。
|
||||
这些范围是 10.0.0.0/8,172.16.0.0/12 和 192.168.0.0/16。
|
||||
默认情况下,代理还将链路本地地址(169.254.0.0/16)视为非伪装 CIDR。
|
||||
代理程序配置为每隔 60 秒从 */etc/config/ip-masq-agent* 重新加载其配置,这也是可修改的。
|
||||
|
||||

|
||||
|
||||
@@ -87,7 +91,7 @@ The agent configuration file must be written in YAML or JSON syntax, and may con
|
||||
<!--
|
||||
* **masqLinkLocal:** A Boolean (true / false) which indicates whether to masquerade traffic to the link local prefix 169.254.0.0/16. False by default.
|
||||
-->
|
||||
* **masqLinkLocal:** 布尔值 (true / false),表示是否将流量伪装到本地链路前缀169.254.0.0/16。 默认为 false。
|
||||
* **masqLinkLocal:** 布尔值 (true / false),表示是否将流量伪装到本地链路前缀 169.254.0.0/16。默认为 false。
|
||||
|
||||
<!--
|
||||
* **resyncInterval:** An interval at which the agent attempts to reload config from disk. e.g. '30s' where 's' is seconds, 'ms' is milliseconds etc...
|
||||
@@ -97,7 +101,10 @@ The agent configuration file must be written in YAML or JSON syntax, and may con
|
||||
<!--
|
||||
Traffic to 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) ranges will NOT be masqueraded. Any other traffic (assumed to be internet) will be masqueraded. An example of a local destination from a pod could be its Node's IP address as well as another node's address or one of the IP addresses in Cluster's IP range. Any other traffic will be masqueraded by default. The below entries show the default set of rules that are applied by the ip-masq-agent:
|
||||
-->
|
||||
10.0.0.0/8,172.16.0.0/12和192.168.0.0/16)范围内的流量不会被伪装。任何其他流量(假设是互联网)将被伪装。pod 访问本地目的地的例子,可以是其节点的 IP 地址、另一节点的地址或集群的 IP 地址范围内的一个 IP 地址。默认情况下,任何其他流量都将伪装。以下条目展示了 ip-masq-agent 的默认使用的规则:
|
||||
10.0.0.0/8、172.16.0.0/12 和 192.168.0.0/16 范围内的流量不会被伪装。
|
||||
任何其他流量(假设是互联网)将被伪装。
|
||||
Pod 访问本地目的地的例子,可以是其节点的 IP 地址、另一节点的地址或集群的 IP 地址范围内的一个 IP 地址。
|
||||
默认情况下,任何其他流量都将伪装。以下条目展示了 ip-masq-agent 的默认使用的规则:
|
||||
|
||||
<!--
|
||||
```
|
||||
@@ -123,9 +130,11 @@ MASQUERADE all -- anywhere anywhere /* ip-masq-agent:
|
||||
<!--
|
||||
By default, in GCE/Google Kubernetes Engine starting with Kubernetes version 1.7.0, if network policy is enabled or you are using a cluster CIDR not in the 10.0.0.0/8 range, the ip-masq-agent will run in your cluster. If you are running in another environment, you can add the ip-masq-agent [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) to your cluster:
|
||||
-->
|
||||
默认情况下,从 Kubernetes 1.7.0 版本开始的 GCE/Google Kubernetes Engine 中,如果启用了网络策略,或者您使用的集群 CIDR 不在 10.0.0.0/8 范围内,则 ip-masq-agent 将在您的集群中运行。如果您在其他环境中运行,则可以将 ip-masq-agent [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) 添加到您的集群:
|
||||
|
||||
|
||||
默认情况下,从 Kubernetes 1.7.0 版本开始的 GCE/Google Kubernetes Engine 中,
|
||||
如果启用了网络策略,或者你使用的集群 CIDR 不在 10.0.0.0/8 范围内,
|
||||
则 ip-masq-agent 将在你的集群中运行。
|
||||
如果你在其他环境中运行,则可以将 ip-masq-agent
|
||||
[DaemonSet](/zh/docs/concepts/workloads/controllers/daemonset/) 添加到你的集群:
|
||||
|
||||
<!-- steps -->
|
||||
|
||||
@@ -143,7 +152,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/ip-masq-
|
||||
<!--
|
||||
You must also apply the appropriate node label to any nodes in your cluster that you want the agent to run on.
|
||||
-->
|
||||
您必须同时将适当的节点标签应用于集群中希望代理运行的任何节点。
|
||||
你必须同时将适当的节点标签应用于集群中希望代理运行的任何节点。
|
||||
|
||||
`
|
||||
kubectl label nodes my-node beta.kubernetes.io/masq-agent-ds-ready=true
|
||||
@@ -157,7 +166,11 @@ More information can be found in the ip-masq-agent documentation [here](https://
|
||||
<!--
|
||||
In most cases, the default set of rules should be sufficient; however, if this is not the case for your cluster, you can create and apply a [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) to customize the IP ranges that are affected. For example, to allow only 10.0.0.0/8 to be considered by the ip-masq-agent, you can create the following [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) in a file called "config".
|
||||
-->
|
||||
在大多数情况下,默认的规则集应该足够;但是,如果您的群集不是这种情况,则可以创建并应用 [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) 来自定义受影响的 IP 范围。 例如,要允许 ip-masq-agent 仅作用于 10.0.0.0/8,您可以一个名为 “config” 的文件中创建以下 [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/) 。
|
||||
在大多数情况下,默认的规则集应该足够;但是,如果你的群集不是这种情况,则可以创建并应用
|
||||
[ConfigMap](/zh/docs/tasks/configure-pod-container/configure-pod-configmap/)
|
||||
来自定义受影响的 IP 范围。
|
||||
例如,要允许 ip-masq-agent 仅作用于 10.0.0.0/8,你可以一个名为 “config” 的文件中创建以下
|
||||
[ConfigMap](/zh/docs/tasks/configure-pod-container/configure-pod-configmap/) 。
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
@@ -175,7 +188,7 @@ resyncInterval: 60s
|
||||
<!--
|
||||
Run the following command to add the config map to your cluster:
|
||||
-->
|
||||
运行以下命令将配置映射添加到您的集群:
|
||||
运行以下命令将配置映射添加到你的集群:
|
||||
|
||||
```
|
||||
kubectl create configmap ip-masq-agent --from-file=config --namespace=kube-system
|
||||
@@ -185,8 +198,9 @@ kubectl create configmap ip-masq-agent --from-file=config --namespace=kube-syste
|
||||
This will update a file located at */etc/config/ip-masq-agent* which is periodically checked every *resyncInterval* and applied to the cluster node.
|
||||
After the resync interval has expired, you should see the iptables rules reflect your changes:
|
||||
-->
|
||||
这将更新位于 */etc/config/ip-masq-agent* 的一个文件,该文件以 *resyncInterval* 为周期定期检查并应用于集群节点。
|
||||
重新同步间隔到期后,您应该看到您的更改在 iptables 规则中体现:
|
||||
这将更新位于 */etc/config/ip-masq-agent* 的一个文件,该文件以 *resyncInterval*
|
||||
为周期定期检查并应用于集群节点。
|
||||
重新同步间隔到期后,你应该看到你的更改在 iptables 规则中体现:
|
||||
|
||||
<!--
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user