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









New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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









New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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









New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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









New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 19 at 14:22









Joel

1,4101119




1,4101119






New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 19 at 10:41









Subit Das

61




61




New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • 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
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








New contributor




Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    0
    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













      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








      New contributor




      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.


















      • 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
      });


      }
      });






      Subit Das is a new contributor. Be nice, and check out our Code of Conduct.










       

      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
      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








      New contributor




      Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        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








        New contributor




        Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




















          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








          New contributor




          Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          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








          New contributor




          Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 2 days ago









          Subit Das

          61




          61




          New contributor




          Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Subit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.
























              up vote
              0
              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













                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










                  up vote
                  0
                  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 2 days ago

























                  answered 2 days ago









                  Frank B

                  35017




                  35017






















                      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








                      New contributor




                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.


















                      • 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








                      New contributor




                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.


















                      • 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








                      New contributor




                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.









                      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








                      New contributor




                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.









                      share|improve this answer



                      share|improve this answer






                      New contributor




                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.









                      answered Nov 19 at 11:09









                      Anna Slastnikova

                      392




                      392




                      New contributor




                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.





                      New contributor





                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.






                      Anna Slastnikova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.












                      • 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












                      Subit Das is a new contributor. Be nice, and check out our Code of Conduct.










                       

                      draft saved


                      draft discarded


















                      Subit Das is a new contributor. Be nice, and check out our Code of Conduct.













                      Subit Das is a new contributor. Be nice, and check out our Code of Conduct.












                      Subit Das is a new contributor. Be nice, and check out our Code of Conduct.















                       


                      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

                      Feedback on college project

                      Futebolista

                      Albești (Vaslui)