
apiVersion: apps/v1kind: Deploymentmetadata:name: order-v2namespace: baselabels:app: orderversion: v2spec:replicas: 1selector:matchLabels:app: orderversion: v2template:metadata:labels:app: orderversion: v2spec:containers:- name: orderimage: ccr.ccs.tencentyun.com/zhulei/testorder2:v1imagePullPolicy: Alwaysenv:- name: POD_NAMEvalueFrom:fieldRef:fieldPath: metadata.name- name: REGIONvalue: "guangzhou-zoneA"ports:- containerPort: 7000protocol: TCP

DestinationRule as shown below:

apiVersion: networking.istio.io/v1alpha3kind: DestinationRulemetadata:name: ordernamespace: basespec:host: ordersubsets:- name: v1labels:version: v1- name: v2labels:version: v2exportTo:- '*'
VirtualService definition. If the header-cookie of a request contains vip=false, traffic will be routed to v1 subset of the order service; otherwise, traffic will be routed to v2 subset. That is, member requests and non-member requests will be routed to order v2 and order v1, respectively. This configuration can be performed by submitting the following YAML file to the primary cluster.apiVersion: networking.istio.io/v1alpha3kind: VirtualServicemetadata:name: order-vsnamespace: basespec:hosts:- order.base.svc.cluster.localhttp:- match:- headers:cookie:exact: vip=falseroute:- destination:host: order.base.svc.cluster.localsubset: v1- match:- headers:cookie:exact: vip=trueroute:- destination:host: order.base.svc.cluster.localsubset: v2
VIP field in the header, the traffic is routed to the originally deployed order v1. Version information can be viewed in the floating window in the bottom-left corner.
The request from a member is routed to v2 as shown below:



Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback