Simple Route Rules
If you have not built the images on your own then let’s deploy the customer pod with its sidecar using the already built images for this tutorial:
Wait for those pods to show "2/2", the istio-proxy/envoy sidecar is part of that pod
NAME READY STATUS RESTARTS AGE
customer-3600192384-fpljb 2/2 Running 0 17m
preference-243057078-8c5hz 2/2 Running 0 15m
recommendation-v2-2815683430-vpx4p 2/2 Running 0 15s
and test the customer endpoint
curl istio-ingressgateway-istio-system.$(minishift ip).nip.io/customer
you likely see "customer => preference => recommendation v1 from '99634814-d2z2t': 3", where '99634814-d2z2t' is the pod running v1 and the 3 is basically the number of times you hit the endpoint.
curl istio-ingressgateway-istio-system.$(minishift ip).nip.io/customer
you likely see "customer => preference => recommendation v2 from '2819441432-5v22s': 1" as by default you get round-robin load-balancing when there is more than one Pod behind a Service
Send several requests to see their responses:
./scripts/run.sh istio-ingressgateway-istio-system.$(minishift ip).nip.io/customer
oc scale --replicas=2 deployment/recommendation-v2 -n tutorial
or
Now, you will see two requests into the v2 and one for v1.
Scale back to a single replica of the recommendation-v2 Deployment
oc scale --replicas=1 deployment/recommendation-v2 -n tutorial
or
kubectl scale --replicas=1 deployment/recommendation-v2 -n tutorial
From the main istio-tutorial directory,
kubectl create -f istiofiles/destination-rule-recommendation-v1-v2.yml -n tutorial
kubectl create -f -n tutorial
./scripts/run.sh istio-ingressgateway-istio-system.$(minishift ip).nip.io/customer
you should only see v2 being returned
Note: "replace" instead of "create" since we are overlaying the previous rule
kubectl replace -f istiofiles/virtual-service-recommendation-v1.yml -n tutorial
kubectl get virtualservice -n tutorial
kubectl get virtualservice -o yaml -n tutorial
By simply removing the rule
kubectl delete -f istiofiles/virtual-service-recommendation-v1.yml -n tutorial
./scripts/run.sh istio-ingressgateway-istio-system.$(minishift ip).nip.io/customer
Canary Deployment scenario: push v2 into the cluster but slowly send end-user traffic to it, if you continue to see success, continue shifting more traffic over time
Create the virtualservice
that will send 90% of requests to v1 and 10% to v2
kubectl create -f -n tutorial
and send in several requests:
./scripts/run.sh istio-ingressgateway-istio-system.$(minishift ip).nip.io/customer
In another terminal, change the mixture to be 75/25
kubectl replace -f istiofiles/virtual-service-recommendation-v1_and_v2_75_25.yml -n tutorial
Clean up
kubectl delete -f istiofiles/virtual-service-recommendation-v1_and_v2_75_25.yml -n tutorial
or you can run:
./scripts/clean.sh tutorial