【问题标题】:Why subdomain tcp routing on EKS istio classic LB doesnt work as expected?为什么 EKS istio 经典 LB 上的子域 tcp 路由无法按预期工作?
【发布时间】:2021-12-30 17:49:54
【问题描述】:

配置:

  1. 路由 53 *.mydomainname.com 指向经典 LB。
  2. 在经典 LB 上配置 istio 入口。
  3. 用于路由特定子域的网关 + 虚拟服务

这里是 yaml:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
  namespace: default
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 9999 
      name: aa
      protocol: TCP
    hosts:
      - "a.example.com"
      - "b.example.com"
---

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: sv1
  namespace: default
spec:
  hosts:
    - "a.example.com"
  gateways:
    - my-gateway
  tcp:
    - route:
      - destination:
          host: svc1 #k8s service on the default namespace
          port:
            number: 8000
        weight: 100

---

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: sv1
  namespace: default
spec:
  hosts:
    - "b.example.com"
  gateways:
    - my-gateway
  tcp:
    - route:
      - destination:
          host: svc2
          port:
            number: 8000
        weight: 100

我希望 a.example.com 流量应该流向 svc1,而 b.example.com 流量应该流向 svc2。 事实上,所有流量 *.example.com 都会路由到 svc1。 我错过了什么? 我怎样才能让它发挥作用?

【问题讨论】:

    标签: amazon-web-services amazon-eks istio istio-gateway


    【解决方案1】:

    标准 TCP 路由不支持主机匹配。主机匹配通常适用于 HTTP 服务,但也可用于使用 TLS 和 SNI 的 TCP 服务。

    这就是为什么您在该特定端口上的所有端点最终都在 svc1 中。

    供参考检查:

    https://istio.io/latest/docs/reference/config/networking/gateway/#Server

    【讨论】:

      猜你喜欢
      • 2021-10-03
      • 2018-04-06
      • 2012-10-04
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      • 2010-10-04
      • 1970-01-01
      • 2021-07-21
      相关资源
      最近更新 更多