我有两个Pod在ClusterIP服务公开的Kubernetes中运行,假设是nginx-1和nginx-2。我想创建一个虚拟服务nginx-split,它将75%的流量路由到nginx-1,25%的流量路由到nginx-2。我从文档中理解的是,我应该创建一个VirtualService定义文件:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: nginx
spec:
hosts:
- nginx-split
http:
- route:
- destination:
host: nginx-1
weight: 75
- destination:
host: nginx-2
weight: 25VirtualService定义是不够的,也许我还应该创建一个ServiceEntry。问题是,我不知道如何为nginx-split定义服务条目,因为它只是虚拟的,不应该解析为(一个) IP地址。
发布于 2021-02-24 03:13:23
TRAFFIC SPLITTING:How it works

流量拆分由two Istio Objects:处理
我们创建一个VirtualService,其中列出了它们的weight的不同变体
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: service-a
spec:
hosts:
- service-a
http:
- route:
- destination:
host: service-a
subset: v1
weight: 80
- destination:
host: service-a
subset: v2
weight: 20然后,DestinationRule负责定义流量的目的地和流量策略:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: property-business-service
spec:
host: property-business-service
subsets:
- name: v1
labels:
version: "1.0"
- name: v2
labels:
version: "1.1"https://stackoverflow.com/questions/66324305
复制相似问题