1

伙计们!我想通过使用 hcm 来分配出口流量,例如

www.xxx.com:8000(边车) -> clusterA(出口)

www.yyy.com:8000(边车) -> clusterB(出口)

休息请求(边车)-> 原始进程(出口)

匹配请求可以正确路由,但是不匹配请求怎么办?

不匹配的请求现在得到 404 响应。

我想在原始路径中处理不匹配的请求。

那么如何修改yaml配置来实现这个目标??有没有最佳实践?</p>

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: test
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: egressgateway
  configPatches:
    - applyTo: NETWORK_FILTER
      match:
        context: GATEWAY
        listener:
          filterChain:
            filter:
              name: "envoy.filters.network.http_connection_manager"
      patch:
        operation: REPLACE
        value:
          name: envoy.filters.network.http_connection_manager
          typed_config:
            "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
            codec_type: AUTO
            stat_prefix: ingress_http
            route_config:
              name: local_route
              virtual_hosts:
              - name: local_service1
                domains: ["www.xxx.com:8000"]
                routes:
                - match:
                    prefix: "/"
                  route:
                    host_rewrite_literal: www.xxx.com:80
                    prefix_rewrite: "/"
                    cluster: "clusterA"
              - name: local_service2
                domains: ["www.yyy.com:8000"]
                routes:
                - match:
                    prefix: "/"
                  route:
                    host_rewrite_literal: www.yyy.com:80
                    prefix_rewrite: "/"
                    cluster: "clusterB"

            http_filters:
              - name: envoy.filters.http.router
                typed_config:
                  "@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
    
    #... other configure here.
    # cluster configure
4

0 回答 0