0
votes

Is ISTIO internal traffic routing to different versions possible even when I use custom gateways? (Azure App gateway). Below is my use case. I have two different versions of deployments (Kubernetes) with the labels app:myapp & version: v1 and version: v2 [v1 label for one deployment and v2 label for another]. The traffic is currently evenly distributed between these two and the same can be seen in kiali dashboard too. I want to route traffic only to v2. Below are my virtual service and destination rules.

VIRTUAL SERVICE:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: myvirtualservice
  namespace: mynamespace # Use same namespace with backend service
spec:
  hosts:
  - myservice.namespace.svc.cluster.local
  ingress:
  - appgw # define ingress name
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 80 # Backend service port
        host: myservice.namespace.svc.cluster.local # Backend service name
        subset: v2

DESTINATION RULE:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: mydestrule
spec:
  host: myservice.namespace.svc.cluster.local
  subsets:
  - name: v2
    labels:
      version: v2

Currently in the kiali dashboard too my azure ingress gateway is shown as "unknown" resource.

1

1 Answers

1
votes

If I see it correctly you are missing the subset selector in the Destination of the VirtualService. If you configure the VirtualService like this it should work better:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: myvirtualservice
  namespace: mynamespace # Use same namespace with backend service
spec:
  hosts:
  - myservice.namespace.svc.cluster.local
  ingress:
  - appgw # define ingress name
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 80
        host: myservice.namespace.svc.cluster.local 
        subset: v2 # <- Route to the subset v2 and enable endpoint select by label

See https://istio.io/docs/reference/config/networking/virtual-service/#Destination