mirror of https://github.com/istio/istio.io.git
[zh] Sync /traffic-management/network-topologies/ (#14148)
This commit is contained in:
parent
0de72af162
commit
eba9807620
|
@ -207,7 +207,7 @@ x-forwarded-client-cert(XFCC)是一个代理请求头,
|
|||
代理商可以选择在代理请求之前对 XFCC 请求头进行清理/附加/转发。
|
||||
{{< /quote >}}
|
||||
|
||||
配置如何处理 XFCC 头文件,需要在 `IstioOperator` 中设置 `forwardClientCertDetails`:
|
||||
要配置如何处理 XFCC 头文件,需要在 `IstioOperator` 中设置 `forwardClientCertDetails`:
|
||||
|
||||
{{< text syntax=yaml snip_id=none >}}
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
|
@ -249,62 +249,27 @@ PROXY 协议不应该用于 L7 流量,也不应该在 L7 负载均衡器后使
|
|||
{{< /warning >}}
|
||||
|
||||
如果外部负载均衡器配置为转发 TCP 流量并使用 PROXY 协议,Istio Gateway TCP 侦听器也必须配置为接受 PROXY 协议。
|
||||
启用该功能需要在 Gateway 工作负载上使用 `EnvoyFilter` 添加
|
||||
[Envoy PROXY 协议过滤器](https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/listener_filters/proxy_protocol)。
|
||||
要在 Gateway 的所有 TCP 侦听器上启用 PROXY 协议,请在您的 `IstioOperator` 中设置 `proxyProtocol`。
|
||||
示例:
|
||||
|
||||
{{< tabset category-name="config-api" >}}
|
||||
|
||||
{{< tab name="Istio API" category-value="istio-apis" >}}
|
||||
|
||||
{{< text syntax=yaml snip_id=none >}}
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: EnvoyFilter
|
||||
metadata:
|
||||
name: proxy-protocol
|
||||
namespace: istio-system
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
configPatches:
|
||||
- applyTo: LISTENER_FILTER
|
||||
patch:
|
||||
operation: INSERT_FIRST
|
||||
value:
|
||||
name: proxy_protocol
|
||||
typed_config:
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol"
|
||||
workloadSelector:
|
||||
labels:
|
||||
istio: ingressgateway
|
||||
meshConfig:
|
||||
defaultConfig:
|
||||
gatewayTopology:
|
||||
proxyProtocol: {}
|
||||
{{< /text >}}
|
||||
|
||||
{{< /tab >}}
|
||||
另外部署具有以下 Pod 注解的 Gateway:
|
||||
|
||||
{{< tab name="Gateway API" category-value="gateway-api" >}}
|
||||
|
||||
{{< text syntax=yaml snip_id=none >}}
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: EnvoyFilter
|
||||
{{< text yaml >}}
|
||||
metadata:
|
||||
name: proxy-protocol
|
||||
namespace: istio-system
|
||||
spec:
|
||||
configPatches:
|
||||
- applyTo: LISTENER_FILTER
|
||||
patch:
|
||||
operation: INSERT_FIRST
|
||||
value:
|
||||
name: proxy_protocol
|
||||
typed_config:
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol"
|
||||
workloadSelector:
|
||||
labels:
|
||||
istio.io/gateway-name: <GATEWAY_NAME>
|
||||
annotations:
|
||||
"proxy.istio.io/config": '{"gatewayTopology" : { "proxyProtocol": {} }}'
|
||||
{{< /text >}}
|
||||
|
||||
{{< /tab >}}
|
||||
|
||||
{{< /tabset >}}
|
||||
|
||||
客户端 IP 从 PROXY 协议中由 Gateway 获取,并在 `X-Forwarded-For` 和 `X-Envoy-External-Address` 头中设置(或附加)。
|
||||
请注意,PROXY 协议与 `X-Forwarded-For` 和 `X-Envoy-External-Address` 等 L7 请求头互斥。
|
||||
当 PROXY 协议与 `gatewayTopology` 配置一起使用时,在确定可信客户端地址时会优先使用 `numTrustedProxies`
|
||||
|
|
|
@ -178,67 +178,14 @@ spec:
|
|||
### TCP/UDP 代理负载均衡器 {#tcp-proxy}
|
||||
|
||||
如果您使用的是 TCP/UDP 代理外部负载均衡器 (AWS Classic ELB),
|
||||
它可以使用[代理协议](https://www.haproxy.com/blog/haproxy/proxy-protocol/)
|
||||
将原始客户端 IP 地址嵌入到分组数据中。外部负载均衡器和 Istio Ingress 网关都必须支持代理协议才能工作。
|
||||
在 Istio 中,您可以通过如下所示的 `EnvoyFilter` 启用:
|
||||
它可以使用 [PROXY 协议](https://www.haproxy.com/blog/haproxy/proxy-protocol/)
|
||||
将原始客户端 IP 地址嵌入到分组数据中。外部负载均衡器和 Istio Ingress 网关都必须支持 PROXY 协议才能工作。
|
||||
|
||||
以下是一个样例配置,显示了如何在支持 PROXY 协议的 AWS EKS 上部署 Ingress Gateway:
|
||||
|
||||
{{< tabset category-name="config-api" >}}
|
||||
|
||||
{{< tab name="Istio APIs" category-value="istio-apis" >}}
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: EnvoyFilter
|
||||
metadata:
|
||||
name: proxy-protocol
|
||||
namespace: istio-system
|
||||
spec:
|
||||
configPatches:
|
||||
- applyTo: LISTENER_FILTER
|
||||
patch:
|
||||
operation: INSERT_FIRST
|
||||
value:
|
||||
name: proxy_protocol
|
||||
typed_config:
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol"
|
||||
workloadSelector:
|
||||
labels:
|
||||
istio: ingressgateway
|
||||
{{< /text >}}
|
||||
|
||||
{{< /tab >}}
|
||||
|
||||
{{< tab name="Gateway API" category-value="gateway-api" >}}
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: EnvoyFilter
|
||||
metadata:
|
||||
name: proxy-protocol
|
||||
namespace: foo
|
||||
spec:
|
||||
configPatches:
|
||||
- applyTo: LISTENER_FILTER
|
||||
patch:
|
||||
operation: INSERT_FIRST
|
||||
value:
|
||||
name: proxy_protocol
|
||||
typed_config:
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol"
|
||||
workloadSelector:
|
||||
labels:
|
||||
istio.io/gateway-name: httpbin-gateway
|
||||
{{< /text >}}
|
||||
|
||||
{{< /tab >}}
|
||||
|
||||
{{< /tabset >}}
|
||||
|
||||
以下是一个示例配置,展示了如何使 AWS EKS 上的 Ingress 网关支持代理协议:
|
||||
|
||||
{{< tabset category-name="config-api" >}}
|
||||
|
||||
{{< tab name="Istio APIs" category-value="istio-apis" >}}
|
||||
{{< tab name="Istio API" category-value="istio-apis" >}}
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
|
@ -247,6 +194,9 @@ spec:
|
|||
meshConfig:
|
||||
accessLogEncoding: JSON
|
||||
accessLogFile: /dev/stdout
|
||||
defaultConfig:
|
||||
gatewayTopology:
|
||||
proxyProtocol: {}
|
||||
components:
|
||||
ingressGateways:
|
||||
- enabled: true
|
||||
|
@ -271,11 +221,11 @@ metadata:
|
|||
name: httpbin-gateway
|
||||
annotations:
|
||||
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"
|
||||
proxy.istio.io/config: '{"gatewayTopology" : { "proxyProtocol": {} }}'
|
||||
spec:
|
||||
gatewayClassName: istio
|
||||
...
|
||||
---
|
||||
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
|
@ -353,13 +303,13 @@ spec:
|
|||
## 基于 IP 的允许列表和拒绝列表 {#ip-based-allow-list-and-deny-list}
|
||||
|
||||
**何时使用 `ipBlocks` 与 `remoteIpBlocks`:** 如果您使用 X-Forwarded-For HTTP 头部
|
||||
或代理协议来确定原始客户端 IP 地址,则应在 `AuthorizationPolicy` 中使用 `remoteIpBlocks`。
|
||||
或 PROXY 协议来确定原始客户端 IP 地址,则应在 `AuthorizationPolicy` 中使用 `remoteIpBlocks`。
|
||||
如果您使用的是 `externalTrafficPolicy: Local`,那么您的 `AuthorizationPolicy` 中应该使用
|
||||
`ipBlocks`。
|
||||
|
||||
| 负载均衡器类型 | 客户端源 IP | `ipBlocks` 与 `remoteIpBlocks`
|
||||
--------------------|----------------------|---------------------------
|
||||
| TCP Proxy | Proxy Protocol | `remoteIpBlocks`
|
||||
| TCP Proxy | PROXY Protocol | `remoteIpBlocks`
|
||||
| Network | packet source address| `ipBlocks`
|
||||
| HTTP/HTTPS | X-Forwarded-For | `remoteIpBlocks`
|
||||
|
||||
|
|
Loading…
Reference in New Issue