istio document dercribe“将大型虚拟服务和目的地规则拆分成多个资源”
https://istio.io/docs/ops/best-practices/traffic-management/
这是我的virtualService yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: project-b
namespace: test1
spec:
hosts:
- project-b.test1.svc.cluster.local
http:
- match:
- headers:
route-namespace:
exact: "test1"
route:
- destination:
host: project-b.test1.svc.cluster.local
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: project-b-test2
namespace: test1
spec:
hosts:
- project-b.test1.svc.cluster.local
http:
- match:
- headers:
route-namespace:
exact: "test2"
route:
- destination:
host: project-b.test2.svc.cluster.localenter image description here只有一个虚拟服务可用,
发布于 2020-03-25 20:49:31
是的,这是预期行为。
根据istio文档:
在不方便在单个
VirtualService或DestinationRule资源中为特定主机定义完整的路由规则或策略集的情况下,最好是在多个资源中递增地指定主机的配置。Pilot将合并这样的目的地规则,如果它们绑定到网关,则合并这样的虚拟服务。
当为现有主机应用第二个及后续
VirtualService时,istio-pilot会将其他路由规则合并到该主机的现有配置中。但是,在使用此功能时,必须仔细考虑几个注意事项。
VirtualService中规则的评估顺序,但跨资源顺序是未定义的。换句话说,对于跨片段配置的规则没有保证的评估顺序,因此只有在没有冲突的规则或跨fragments.VirtualService只有在绑定到网关时才能以这种方式进行分段。sidecars中不支持主机合并。https://stackoverflow.com/questions/60844131
复制相似问题