Istio 流量控制:细粒度路由、转移与镜像
1. 特定请求路由到 v2
有时,我们希望将包含特定 HTTP 头的流量路由到服务的特定版本。例如,将包含 x-istio-cohort: internal 头的流量路由到 catalog 服务的 v2 版本。可以通过 Istio 的 VirtualService 资源来实现这一请求路由:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: catalog-vs-from-gw
spec:
hosts:
- "catalog.istioinaction.io"
gateways:
- catalog-gateway
http:
- match:
- headers:
x-istio-cohort:
exact: "internal"
route:
- destination:
host: catalog
subset: version-v2
- route:
- destination:
host: catalog
subset: version-v1
更新这个 VirtualService:
kubectl
超级会员免费看
订阅专栏 解锁全文

33

被折叠的 条评论
为什么被折叠?



