istio - 为主机拆分虚拟服务是否可以使用通配符?
问题描述
我有两个虚拟服务,如下图所示,一个带有主机通配符,一个与特定主机匹配。这两个服务匹配不同的前缀。我的期望是 ISTIO 会将这些路由合并到 host mlp2012.mydomain.net
。但这似乎不会发生。如果我将流量发送到http://mlp2012.mydomain.net/mlp2012/debug/echo
;ISTIO 返回 404。但是,如果我删除了虚拟服务mlp2012-host
。然后流量通过;表示第二个虚拟服务正在干扰 prefix 的路由/mlp2012/debug
。
这是否按预期工作?有人可以解释一下这种行为吗?
主机拆分的文档没有提到通配符。
# 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
解决方案
推荐阅读
- python - 如何使用 Python 从 json 中提取和转换货币值?
- javascript - 在 JavaScript 中序列化复杂对象
- powershell - powershell中的docker cp参数扩展
- outlook-addin - 带有 dovecot 的 Outlook 插件
- deployment - SignTool 错误:发生了意外的内部错误。错误 MSB3482
- python - 通过熊猫df进行python多处理
- c++ - 从 UTF-8 字节数组创建字符串?
- r - 如何从数据框列表中添加单个数据框
- ios - 即使在为 Tika 文件添加了新的 mime 类型后,仍将其检测为 application/x-bplist
- python - Tensorflow错误:具有多个元素的数组的真值不明确