apiVersion:networking.istio.io/v1beta1kind:VirtualServicemetadata:name:bookinfo-rulenamespace:bookinfo-namespacespec:hosts: - reviews.prod.svc.cluster.local - uk.bookinfo.com - eu.bookinfo.comgateways: - some-config-namespace/my-gateway - mesh# applies to all the sidecars in the meshhttp: - match: - headers:cookie:exact:"user=dev-123"route: - destination:port:number:7777host:reviews.qa.svc.cluster.local - match: - uri:prefix:/reviews/route: - destination:port:number:9080# can be omitted if it's the only port for reviewshost:reviews.prod.svc.cluster.localweight:80 - destination:host:reviews.qa.svc.cluster.localweight:20
apiVersion:networking.istio.io/v1beta1kind:VirtualServicemetadata:name:bookinfo-Mongonamespace:bookinfo-namespacespec:hosts: - mongosvr.prod.svc.cluster.local# name of internal Mongo servicegateways: - some-config-namespace/my-gateway# can omit the namespace if gateway is in samenamespace as virtual service.tcp: - match: - port:27017route: - destination:host:mongo.prod.svc.cluster.localport:number:5555