配置:
- 路由 53 *.mydomainname.com 指向经典 LB。
- 在经典 LB 上配置的 istio ingress。
- 网关 + 虚拟服务来路由特定的子域
这是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。我错过了什么?我怎样才能让它工作?