<p>For the below files , ISTIO is showing output in the first v1 app only. If I change the  version of the v1 the output changes. So the traffic is not moving to the other version at all.</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: sampleweb
  namespace: default
spec:
  hosts:
  - "web.xyz.com"
  gateways:
  - http-gateway
  http:
  - route:
    - destination:
        port:
          number: 8080
        host: web
        subset: v1
      weight: 30
  - route:
    - destination:
        port:
          number: 8080
        host: web
        subset: v2
      weight: 30
  - route:
    - destination:
        port:
          number: 8080
        host: web
        subset: v3
      weight: 40

---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: samplewebdr
  namespace: default
spec:
  host: web
  subsets:
  - name: v1
    labels:
      app: web
      version: prod
  - name: v2
    labels:
      app: web
      version: baseline
  - name: v3
    labels:
      app: web
      version: canary
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL
</code></pre>

<p>Can anyone please help on this?</p>

Subit Das
<p>Your problem is that you have created a <code>VirtualService</code> with 3 rules in it. The first rule, which has no specific match criteria, is therefore always the one that gets invoked. When you have multiple rules in a <code>VirtualService</code>, you need to be careful to order them properly, as described <a href="https://istio.io/docs/concepts/traffic-management/#precedence" rel="nofollow noreferrer">here</a>.</p>

<p>That said, in your case, you really don't want multiple rules, but rather a single rule with multiple weighted destinations like this:</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: sampleweb
  namespace: default
spec:
  hosts:
  - "web.xyz.com"
  gateways:
  - http-gateway
  http:
  - route:
    - destination:
        port:
          number: 8080
        host: web
        subset: v1
      weight: 30
    - destination:
        port:
         number: 8080
        host: web
        subset: v2
      weight: 30
    - destination:
        port:
          number: 8080
        host: web
        subset: v3
      weight: 40
</code></pre>

<p>Btw, although harmless, you don't need to include the <code>app: web</code> label in you <code>DestinationRule</code> subsets. You only need the labels that uniquely identify the difference between the subsets of the web service.</p>
