我有两个虚拟服务,如下图所示,一个带有主机通配符,另一个匹配特定主机。这两个服务匹配不同的前缀。我的期望是 ISTIO 会将这些路由合并到主机 mlp2012.mydomain.net
的流量。但这似乎不会发生。如果我将流量发送到 http://mlp2012.mydomain.net/mlp2012/debug/echo
; ISTIO 返回 404。但是,如果我删除虚拟服务 mlp2012-host
。然后交通通过;表明第二个虚拟服务正在干扰前缀 /mlp2012/debug
的路由。
这是否按预期工作?有人可以解释一下这种行为吗?
用于主机拆分的 docs 未提及通配符。
# Create a wildcard route that correctly points at the service.
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: mlp2012-wildcard
namespace: mlp-1
spec:
gateways:
- istio-system/ingressgateway
hosts:
- '*'
http:
- match:
- uri:
prefix: /mlp2012/debug/
rewrite:
uri: /
route:
- destination:
port:
number: 80
host: echo-server
---
# Create a host specific route that points to a service that doesn't exist
# This should have a different prefix so it shouldn't match valid traffic.
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: mlp2012-host
namespace: mlp-1
spec:
gateways:
- istio-system/ingressgateway
hosts:
- 'mlp2012.mydomain.net'
http:
- match:
- uri:
prefix: /mlp2012/doesnotexist/
rewrite:
uri: /
route:
- destination:
port:
number: 80
host: doesnotexist