2 个回答
VirtualService:定义了如何路由流量到目标服务,支持根据请求的内容进行流量拆分、路由规则等。通常与 DestinationRule 配合使用,控制流量的方向。
示例:
示例:
apiVersion: networking.istio.io/v1alpha3
kind:VirtualService
metadata:
name:my-service
spec:
hosts:
-my-service.default.svc.cluster.local
http:
-route:
-destination:
host:my-service.default.svc.cluster.local
port:
number:80
weight:90
-destination:
host:my-service-v2.default.svc.cluster.local
port:
number:80
weight: 10
发布于:1个月前 (03-17) IP属地:四川省
DestinationRule:定义了对目标服务的配置。它用于指定如负载均衡策略、连接池设置、超时设置等。例如,可以定义服务的多个版本,并为每个版本设置不同的策略(如不同的超时或重试策略)。
示例:
示例:
apiVersion: networking.istio.io/v1alpha3
kind:DestinationRule
metadata:
name:my-service
spec:
host:my-service.default.svc.cluster.local
trafficPolicy:
loadBalancer:
simple:ROUND_ROBIN
connectionPool:
http:
maxRequestsPerConnection: 1
发布于:1个月前 (03-17) IP属地:四川省
我来回答
您需要 登录 后回答此问题!