Istio: Unable to route traffic to v1 in bookinfo Request Routing example

Created on 4 Aug 2018  路  3Comments  路  Source: istio/istio

Describe the bug

While trying out the request routing example, I attempt to route all traffic to the v1 services using

kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml

and

kubectl apply -f samples/bookinfo/networking/virtual-service-all-v1.yaml

Expected behaviour
no stars should be shown on the page

Actual behaviour
All ratings (red, black & no stars) are shown in a Round robin fashion

Version

Kubernetes

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.2", GitCommit:"81753b10df112992bf51bbc2c2f85208aad78335", GitTreeState:"clean", BuildDate:"2018-05-12T04:12:12Z", GoVersion:"go1.9.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Istio
```Version: 0.8.0
GitRevision: 6f9f420f0c7119ff4fa6a1966a6f6d89b1b4db84
User: root@48d5ddfd72da
Hub: docker.io/istio
GolangVersion: go1.10.1
BuildStatus: Clean

**Env**
Istio + Minikube on OS X

**Additional Info**

**VirtualServices**

$ kubectl get virtualservices -o yaml

apiVersion: v1
items:

  • apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"bookinfo","namespace":"default"},"spec":{"gateways":["bookinfo-gateway"],"hosts":[""],"http":[{"match":[{"uri":{"exact":"/productpage"}},{"uri":{"exact":"/login"}},{"uri":{"exact":"/logout"}},{"uri":{"prefix":"/api/v1/products"}}],"route":[{"destination":{"host":"productpage","port":{"number":9080}}}]}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:50:47Z
    generation: 1
    name: bookinfo
    namespace: default
    resourceVersion: "29545"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/bookinfo
    uid: b791c67b-97b2-11e8-914b-080027e2c043
    spec:
    gateways:

    • bookinfo-gateway

      hosts:

    • ''

      http:

    • match:



      • uri:


        exact: /productpage


      • uri:


        exact: /login


      • uri:


        exact: /logout


      • uri:


        prefix: /api/v1/products


        route:


      • destination:


        host: productpage


        port:


        number: 9080



  • apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"details","namespace":"default"},"spec":{"hosts":["details"],"http":[{"route":[{"destination":{"host":"details","subset":"v1"}}]}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:54:29Z
    generation: 1
    name: details
    namespace: default
    resourceVersion: "29872"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/details
    uid: 3c23cf06-97b3-11e8-914b-080027e2c043
    spec:
    hosts:

    • details

      http:

    • route:



      • destination:


        host: details


        subset: v1



  • apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"productpage","namespace":"default"},"spec":{"hosts":["productpage"],"http":[{"route":[{"destination":{"host":"productpage","subset":"v1"}}]}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:54:29Z
    generation: 1
    name: productpage
    namespace: default
    resourceVersion: "29869"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/productpage
    uid: 3c14e548-97b3-11e8-914b-080027e2c043
    spec:
    hosts:

    • productpage

      http:

    • route:



      • destination:


        host: productpage


        subset: v1



  • apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"ratings","namespace":"default"},"spec":{"hosts":["ratings"],"http":[{"route":[{"destination":{"host":"ratings","subset":"v1"}}]}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:54:29Z
    generation: 1
    name: ratings
    namespace: default
    resourceVersion: "32442"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/ratings
    uid: 3c1955e3-97b3-11e8-914b-080027e2c043
    spec:
    hosts:

    • ratings

      http:

    • route:



      • destination:


        host: ratings


        subset: v1



  • apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"reviews","namespace":"default"},"spec":{"hosts":["reviews"],"http":[{"route":[{"destination":{"host":"reviews","subset":"v1"}}]}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:54:29Z
    generation: 1
    name: reviews
    namespace: default
    resourceVersion: "29870"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/reviews
    uid: 3c170a17-97b3-11e8-914b-080027e2c043
    spec:
    hosts:

    • reviews

      http:

    • route:



      • destination:


        host: reviews


        subset: v1


        kind: List


        metadata:


        resourceVersion: ""


        selfLink: ""



**DestinationRules**

$ kubectl get destinationrules -o yaml

apiVersion: v1
items:

  • apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"DestinationRule","metadata":{"annotations":{},"name":"details","namespace":"default"},"spec":{"host":"details","subsets":[{"labels":{"version":"v1"},"name":"v1"},{"labels":{"version":"v2"},"name":"v2"}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:53:09Z
    generation: 1
    name: details
    namespace: default
    resourceVersion: "29749"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/destinationrules/details
    uid: 0c628239-97b3-11e8-914b-080027e2c043
    spec:
    host: details
    subsets:

    • labels:

      version: v1

      name: v1

    • labels:

      version: v2

      name: v2

  • apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"DestinationRule","metadata":{"annotations":{},"name":"productpage","namespace":"default"},"spec":{"host":"productpage","subsets":[{"labels":{"version":"v1"},"name":"v1"}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:53:09Z
    generation: 1
    name: productpage
    namespace: default
    resourceVersion: "29746"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/destinationrules/productpage
    uid: 0c55f968-97b3-11e8-914b-080027e2c043
    spec:
    host: productpage
    subsets:

    • labels:

      version: v1

      name: v1

  • apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"DestinationRule","metadata":{"annotations":{},"name":"ratings","namespace":"default"},"spec":{"host":"ratings","subsets":[{"labels":{"version":"v1"},"name":"v1"},{"labels":{"version":"v2"},"name":"v2"},{"labels":{"version":"v2-mysql"},"name":"v2-mysql"},{"labels":{"version":"v2-mysql-vm"},"name":"v2-mysql-vm"}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:53:09Z
    generation: 1
    name: ratings
    namespace: default
    resourceVersion: "32457"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/destinationrules/ratings
    uid: 0c5d6caa-97b3-11e8-914b-080027e2c043
    spec:
    host: ratings
    subsets:

    • labels:

      version: v1

      name: v1

    • labels:

      version: v2

      name: v2

    • labels:

      version: v2-mysql

      name: v2-mysql

    • labels:

      version: v2-mysql-vm

      name: v2-mysql-vm

  • apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
    annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"networking.istio.io/v1alpha3","kind":"DestinationRule","metadata":{"annotations":{},"name":"reviews","namespace":"default"},"spec":{"host":"reviews","subsets":[{"labels":{"version":"v1"},"name":"v1"},{"labels":{"version":"v2"},"name":"v2"},{"labels":{"version":"v3"},"name":"v3"}]}}
    clusterName: ""
    creationTimestamp: 2018-08-04T06:53:09Z
    generation: 1
    name: reviews
    namespace: default
    resourceVersion: "29747"
    selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/destinationrules/reviews
    uid: 0c584a38-97b3-11e8-914b-080027e2c043
    spec:
    host: reviews
    subsets:

    • labels:

      version: v1

      name: v1

    • labels:

      version: v2

      name: v2

    • labels:

      version: v3

      name: v3

      kind: List

      metadata:

      resourceVersion: ""

      selfLink: ""

```
Any help would be appreciated, Thanks!

arenetworking

Most helpful comment

@vadimeisenbergibm
That's the issue!
Fixed it by manually injecting it with kube-inject, Thanks!
I guess I haven't properly setup the automatic sidecar injection.

All 3 comments

It could happen if the sidecar proxies were not injected into the bookinfo pods. Can you post the output of kubectl get pods ?

@vadimeisenbergibm
That's the issue!
Fixed it by manually injecting it with kube-inject, Thanks!
I guess I haven't properly setup the automatic sidecar injection.

I'm currently facing this same issue and my pods do have the sidecar proxy injected. I've also checked configuration, clusters, routes, etc., and everything seems to be in place. However, I always get a round-robin for the reviews service. Using 1.0.4 here.

Was this page helpful?
0 / 5 - 0 ratings