How to resolve Istio traffic routing bug?











up vote
1
down vote

favorite












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.



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


Can anyone please help on this?










share|improve this question
























  • Do you have other VS / DR defined than these ones? Maybe some are conflicting.
    – Joel
    Nov 19 at 13:16










  • Could you add information about your deployments (or whatever you have) of your application
    – Artem Golenyaev
    Nov 19 at 15:26















up vote
1
down vote

favorite












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.



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


Can anyone please help on this?










share|improve this question
























  • Do you have other VS / DR defined than these ones? Maybe some are conflicting.
    – Joel
    Nov 19 at 13:16










  • Could you add information about your deployments (or whatever you have) of your application
    – Artem Golenyaev
    Nov 19 at 15:26













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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.



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


Can anyone please help on this?










share|improve this question















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.



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


Can anyone please help on this?







kubernetes istio spinnaker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 14:22









Joel

1,4101119




1,4101119










asked Nov 19 at 10:41









Subit Das

63




63












  • Do you have other VS / DR defined than these ones? Maybe some are conflicting.
    – Joel
    Nov 19 at 13:16










  • Could you add information about your deployments (or whatever you have) of your application
    – Artem Golenyaev
    Nov 19 at 15:26


















  • Do you have other VS / DR defined than these ones? Maybe some are conflicting.
    – Joel
    Nov 19 at 13:16










  • Could you add information about your deployments (or whatever you have) of your application
    – Artem Golenyaev
    Nov 19 at 15:26
















Do you have other VS / DR defined than these ones? Maybe some are conflicting.
– Joel
Nov 19 at 13:16




Do you have other VS / DR defined than these ones? Maybe some are conflicting.
– Joel
Nov 19 at 13:16












Could you add information about your deployments (or whatever you have) of your application
– Artem Golenyaev
Nov 19 at 15:26




Could you add information about your deployments (or whatever you have) of your application
– Artem Golenyaev
Nov 19 at 15:26












3 Answers
3






active

oldest

votes

















up vote
1
down vote













Your problem is that you have created a VirtualService 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 VirtualService, you need to be careful to order them properly, as described here.



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



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


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






share|improve this answer






























    up vote
    0
    down vote













    There were some indentation issues. I resolved it referring the following links



    https://raw.githubusercontent.com/istio/istio/release-1.0/samples/bookinfo/networking/destination-rule-all-mtls.yaml






    share|improve this answer




























      up vote
      -1
      down vote













      I think the problem is that for all versions you've got the same label app: web so istio directs traffic to pods with these labels they're just happened to be the same pod. You need to specify different labels for different versions like vor v2 the label is version: v1, for v2 - version: v2 and you also need to create pods with these labels.






      share|improve this answer





















      • Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
        – Subit Das
        Nov 19 at 12:06













      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372861%2fhow-to-resolve-istio-traffic-routing-bug%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      Your problem is that you have created a VirtualService 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 VirtualService, you need to be careful to order them properly, as described here.



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



      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


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






      share|improve this answer



























        up vote
        1
        down vote













        Your problem is that you have created a VirtualService 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 VirtualService, you need to be careful to order them properly, as described here.



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



        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


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






        share|improve this answer

























          up vote
          1
          down vote










          up vote
          1
          down vote









          Your problem is that you have created a VirtualService 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 VirtualService, you need to be careful to order them properly, as described here.



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



          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


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






          share|improve this answer














          Your problem is that you have created a VirtualService 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 VirtualService, you need to be careful to order them properly, as described here.



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



          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


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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 20 at 19:29

























          answered Nov 20 at 19:07









          Frank B

          36017




          36017
























              up vote
              0
              down vote













              There were some indentation issues. I resolved it referring the following links



              https://raw.githubusercontent.com/istio/istio/release-1.0/samples/bookinfo/networking/destination-rule-all-mtls.yaml






              share|improve this answer

























                up vote
                0
                down vote













                There were some indentation issues. I resolved it referring the following links



                https://raw.githubusercontent.com/istio/istio/release-1.0/samples/bookinfo/networking/destination-rule-all-mtls.yaml






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  There were some indentation issues. I resolved it referring the following links



                  https://raw.githubusercontent.com/istio/istio/release-1.0/samples/bookinfo/networking/destination-rule-all-mtls.yaml






                  share|improve this answer












                  There were some indentation issues. I resolved it referring the following links



                  https://raw.githubusercontent.com/istio/istio/release-1.0/samples/bookinfo/networking/destination-rule-all-mtls.yaml







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 at 4:25









                  Subit Das

                  63




                  63






















                      up vote
                      -1
                      down vote













                      I think the problem is that for all versions you've got the same label app: web so istio directs traffic to pods with these labels they're just happened to be the same pod. You need to specify different labels for different versions like vor v2 the label is version: v1, for v2 - version: v2 and you also need to create pods with these labels.






                      share|improve this answer





















                      • Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
                        – Subit Das
                        Nov 19 at 12:06

















                      up vote
                      -1
                      down vote













                      I think the problem is that for all versions you've got the same label app: web so istio directs traffic to pods with these labels they're just happened to be the same pod. You need to specify different labels for different versions like vor v2 the label is version: v1, for v2 - version: v2 and you also need to create pods with these labels.






                      share|improve this answer





















                      • Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
                        – Subit Das
                        Nov 19 at 12:06















                      up vote
                      -1
                      down vote










                      up vote
                      -1
                      down vote









                      I think the problem is that for all versions you've got the same label app: web so istio directs traffic to pods with these labels they're just happened to be the same pod. You need to specify different labels for different versions like vor v2 the label is version: v1, for v2 - version: v2 and you also need to create pods with these labels.






                      share|improve this answer












                      I think the problem is that for all versions you've got the same label app: web so istio directs traffic to pods with these labels they're just happened to be the same pod. You need to specify different labels for different versions like vor v2 the label is version: v1, for v2 - version: v2 and you also need to create pods with these labels.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 19 at 11:09









                      Anna Slastnikova

                      392




                      392












                      • Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
                        – Subit Das
                        Nov 19 at 12:06




















                      • Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
                        – Subit Das
                        Nov 19 at 12:06


















                      Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
                      – Subit Das
                      Nov 19 at 12:06






                      Labels: app=web app.kubernetes.io/managed-by=spinnaker app.kubernetes.io/name=web pod-template-hash=2895261194 version=canary
                      – Subit Das
                      Nov 19 at 12:06




















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372861%2fhow-to-resolve-istio-traffic-routing-bug%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                      Alcedinidae

                      Can an atomic nucleus contain both particles and antiparticles? [duplicate]