Let say I have VirtualService Foo
that has rule to manage team.company.com/foo
http path, and bind it to the Gateway TeamGateway
(that has host team.company.com). Then introduce another VirtualService Bar
to manage team.company.com/bar
rule path to certain backend, bind to the same Gateway TeamGateway
. Is it possible?
Most probably you can do this by matching the uri prefix and even using 1 VirtualService.
Gateway should look like:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: your-new-gateway
spec:
selector:
app: your-new-gateway-controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- team.company.com
After defining Gateway you create VirtualService matching it to different prefixes:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: vs-rule
spec:
hosts:
- team.company.com
gateways:
- your-new-gateway
http:
- match:
uri:
prefix: /foo/
route:
- destination:
host: your_1.svc.cluster.local #Kubernetes underlying service name
- match:
uri:
prefix: /bar/
route:
- destination:
host: your_2.svc.cluster.local #Kubernetes underlying service name