Istio: Content-based routing doesn't work

Created on 18 May 2018  路  3Comments  路  Source: istio/istio

env:

ubuntu: 16.04
istio version: istio-release-0.8-20180518-01-13(daily build)
kubenetes version: v1.10.0

Steps:

  1. Get latest daily build for istio-release-0.8 from https://gcsweb.istio.io/gcs/istio-release-pipeline-data/daily-build/release-0.8-20180518-01-13/
curl -LO https://storage.googleapis.com/istio-release-pipeline-data/daily-build/release-0.8-20180518-01-13/istio-release-0.8-20180518-01-13-linux.tar.gz
tar -xzvf istio-release-0.8-20180518-01-13-linux.tar.gz
cd istio-release-0.8-20180518-01-13
export PATH=$PWD/bin:$PATH
  1. Install Istio core components
kubectl apply -f install/kubernetes/istio-demo.yaml
  1. Deployment bookinfo with manual injection and define the ingress gateway
kubectl apply -f <(istioctl kube-inject --debug -f samples/bookinfo/kube/bookinfo.yaml)
istioctl create -f samples/bookinfo/routing/bookinfo-gateway.yaml
  1. Access the bookinfo application from browser with http://${GATEWAY_URL}/productpage
export GATEWAY_URL=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}'):$(kubectl get svc istio-ingressgateway -n istio-system -o 'jsonpath={.spec.ports[0].nodePort}')
echo http://${GATEWAY_URL}/productpage

Refresh the page several times, I can see different versions of reviews shown in productpage, presented in a round robin style (red stars, black stars, no stars), since I haven鈥檛 yet used Istio to control the version routing.

  1. Set the default version for all microservices to v1 and wait a few seconds for the rules to propagate to all pods before attempting to access the application.
istioctl create -f samples/bookinfo/routing/route-rule-all-v1.yaml
  1. Open the Bookinfo URL (http://$GATEWAY_URL/productpage) in your browser
    problem:
    I still can see different versions of reviews shown in productpage, presented in a round robin style (red stars, black stars, no stars)
    expected
    The productpage is displayed with no rating stars since reviews:v1 does not access the ratings service.

Looks like there are some mismatched items in samples/bookinfo/routing/route-rule-all-v1.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: productpage
spec:
  hosts:
  - productpage
  gateways:
  - bookinfo
  - mesh #TODO remove this if not needed
  http:
  - route:
    - destination:
        host: productpage
        subset: v1

For I just defined gateway named bookinfo-gateway in samples/bookinfo/routing/bookinfo-gateway.yaml, however after I update bookinfo to bookinfo-gateway, the results remain unchanged.
Have I missed somethings as I followed the latest doc?

/cc @gyliu513

Most helpful comment

@morvencao
It's probably because the injected proxy is v1 rather than v2 and therefore the destination rules are being ignored.

You can ask istioctl to inject proxyv2 by setting an env variable ISTIO_PROXY_IMAGE=proxyv2
or run the following injection command instead:

kubectl apply -f <(ISTIO_PROXY_IMAGE=proxyv2 istioctl kube-inject --debug -f samples/bookinfo/kube/bookinfo.yaml)

All 3 comments

@morvencao
It's probably because the injected proxy is v1 rather than v2 and therefore the destination rules are being ignored.

You can ask istioctl to inject proxyv2 by setting an env variable ISTIO_PROXY_IMAGE=proxyv2
or run the following injection command instead:

kubectl apply -f <(ISTIO_PROXY_IMAGE=proxyv2 istioctl kube-inject --debug -f samples/bookinfo/kube/bookinfo.yaml)

@ymesika It works, thanks a lot.

Posted a PR here https://github.com/istio/istio.github.io/pull/1329 to fix this issue.

Was this page helpful?
0 / 5 - 0 ratings