istio traffic mirroring lab and sample
Istio support traffic mirroring and the configuration can be added in the virtual service itself.
In this example, I am using httpbin to demonstrate traffic mirroring.
1. Deploy httpbin v1 and v2 - So i have 2 pods running httpbin with different labels.
2. Setup gateway, virtual service and destination rules. The destination rule supports subsets.
3. Then turn on mirroring on the virtual service.
Steps
Deploy 2 different version of httpbin - v1 and v2 by running the following command:-
kubectl apply -f .\httpbin.yaml -n test
kubectl apply -f .\httpbin-v2.yaml -n test
Deploy the httpbin-gateway
kubectl apply .\httpbin-gateway.yaml -n test
Run a few curl http://localhost At this point you can check to see the logs for your pods.
kubectl logs your-v1-pod-name -n test
There should be output and no output/request going into podv2
Turning on mirroring
kubectl apply .\httpbin-gateway-v2.yaml -n test
kubectl logs your-v1-pod-name -n test kubectl logs your-v2-pod-name -n test
Check to ensure that logs is coming out for both pods.
The sample code can be found here
https://github.com/mitzenjeremywoo/istio-mirroring-example
Can traffic routing happens without setting up destination rule subset?
You must setup deistination rule subset that matches the virtual service traffic mirroring subset definitions:-
Comments