Service routes and version subsets should be in place given the destination rules applied in Lab 3. If they are not present, re-apply the destination rules:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: productpage
spec:
host: productpage
subsets:
- name: v1
labels:
version: v1
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: reviews
spec:
host: reviews
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
- name: v3
labels:
version: v3
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: ratings
spec:
host: ratings
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
- name: v2-mysql
labels:
version: v2-mysql
- name: v2-mysql-vm
labels:
version: v2-mysql-vm
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: details
spec:
host: details
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
---
Some basics to get us started.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
Using Meshery, apply custom configuration.
Refresh BookInfo productpage.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v2
Using Meshery, apply custom configuration.
Refresh BookInfo productpage.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: bookinfo
spec:
hosts:
- "bookinfo.meshery.io"
gateways:
- sample-app-gateway
http:
- match:
- headers:
User-Agent:
regex: ^.*Mobile.*$
route:
- headers:
request:
set:
x-response: "Success with Mobile"
destination:
host: productpage
port:
number: 9080
- route:
- destination:
host: product
subset: random
Set your browser to mimic a mobile device. Enable Developer tools, if need. Refresh BookInfo productpage.
Example of using user information from HTTP headers to redirect requests.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: naruto
route:
- destination:
host: reviews
subset: v2
- match:
- headers:
end-user:
exact: sasuke
route:
- destination:
host: reviews
subset: v3
- route:
- destination:
host: reviews
subset: v1
You will need to generate load on BookInfo's productpage service. See Lab 4 for instructions for running a performance test.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 100
mirror:
host: reviews
subset: v2
mirror_percent: 100
5.3
Incrmentally increase the traffic split percentage to the higher version service #. Start at 20% traffic split
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 80
- destination:
host: reviews
subset: v3
weight: 20
Move to 50%. Observe in Meshery.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 50
- destination:
host: reviews
subset: v3
weight: 50
Acknowledging the fallacy that the network is always reliable, you will intentionally cause a little chaos.
Note Istio Proxy's default timeout settings.
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: naruto
fault:
delay:
percentage:
value: 100.0
fixedDelay: 11s
route:
- destination:
host: reviews
subset: v1
- route:
- destination:
host: reviews
subset: v2
Note
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings
spec:
hosts:
- ratings
http:
- match:
- headers:
end-user:
exact: naruto
fault:
delay:
percentage:
value: 100.0
fixedDelay: 5s
route:
- destination:
host: ratings
subset: v1
- route:
- destination:
host: ratings
subset: v1
Overcoming the latency issue.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
retries:
attempts: 5
perTryTimeout: 3s
Continue to Lab 6: Exploring security capabilities in Istio
Alternative, manual installation steps are provided for reference below. No need to execute these if you have performed the steps above.
If you haven't forked or cloned this repository, please do so now:
git clone https://github.com/layer5io/advanced-istio-service-mesh-workshop
kubectl apply -f route-v1-v2/v1.yaml
kubectl apply -f route-v1-v2/v2.yaml
kubectl apply -f route-header/device.yaml
kubectl apply -f route-header/user.yaml