multi-cluster/multi-primary 网格中的共享 istio 出口网关

Shared istio egress gateway in multi-cluster/multi-primary mesh

我们正在尝试在 multi-cluster/multi-primary 网格中设置出口网关 出口网关仅位于一个集群但同时被两个集群使用的配置。

diagram of desired setup

用例是集群位于不同的网络区域,我们希望能够 将流量透明地路由到一个区域到另一个区域中的客户端。

我们在一个集群中跟踪了 this guide,它运行良好。但是我们在第二个集群中设置 VirtualService 时遇到了问题 在第一个集群中使用出口网关。

将以下虚拟服务部署到第二个集群时,我们得到 503 cluster_not_found。

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: direct-cnn-through-egress-gateway
spec:
  hosts:
  - edition.cnn.com
  gateways:
  - istio-egressgateway
  - mesh
  http:
  - match:
    - gateways:
      - mesh
      port: 80
    route:
    - destination:
        host: istio-egressgateway.istio-system.svc.cluster.local
        port:
          number: 80
      weight: 100
  - match:
    - gateways:
      - istio-egressgateway
      port: 80
    route:
    - destination:
        host: edition.cnn.com
        port:
          number: 80
      weight: 100

第二个集群中 pod 上的端点代理配置缺少 istio-egressgateway.istio-gateways.svc.cluster.local 端点(发现所有其他服务并将其定向到其他集群的东西网关)。 我们认为这就是 VirtualService 在第二个集群中不起作用的原因。

作为解决方法,我们可以将出口流量重定向到第一个集群的入口网关,但这 缺点是流量离开并重新进入网格,这可能会对跟踪和监控产生影响。

目前是否可以设置一个可供网格中的所有集群使用的单一出口网关,还是我们必须采用解决方法?

根据评论,解决方案应按如下方式工作:

要创建多集群部署,您可以使用 this tutorial. In this situation cross cluster workload of normal services works fine. However, there is a problem with getting the traffic to the egress gateway routed via the eastwest gateway. This can be solved with this example。 您还应该将两个集群中的 kind: VirtualService 更改为 kind: ServiceEntry

Tobias Henkel提到的:

I got it to work fine with the service entry if I target the ingress gateway on ports 80/443 which then dispatches further to the mesh external services.


您还可以使用 Admiral 自动进行流量路由。

另请参阅: