Istio事例bookinfo
部署
[root@k8s-master samples]# kubectl apply -f istio/samples/bookinfo/platform/kube/bookinfo.yaml
[root@k8s-master samples]# kubectl apply -f istio/samples/bookinfo/networking/bookinfo-gateway.yaml
浏览器访问多刷新几次会访问到不同版本的Reviewer
划分子集
kubectl apply -f istio/samples/bookinfo/networking/destination-rule-all
[root@k8s-master samples]# istioctl pc cluster productpage-v1-5586c4d4ff-5544h
所有流量都路由到V1
[root@k8s-master istio]# kubectl apply -f samples/bookinfo/networking/virtual-service-all-v1.yaml
浏览器在访问一直都是v1版本
jason登录显示V2版本
[root@k8s-master istio]# kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml
virtualservice.networking.istio.io/reviews configured
注入一个超时的故障
[root@k8s-master istio]# kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-test-delay.yaml
virtualservice.networking.istio.io/ratings configured
注入一个中断故障
[root@k8s-master istio]# kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-test-abort.yaml
virtualservice.networking.istio.io/ratings configured
设置权重50%v1 50%v3
[root@k8s-master istio]# kubectl apply -f samples/bookinfo/networking/virtual-service-all-v1.yaml
virtualservice.networking.istio.io/productpage unchanged
virtualservice.networking.istio.io/reviews unchanged
virtualservice.networking.istio.io/ratings unchanged
virtualservice.networking.istio.io/details unchanged
[root@k8s-master istio]# kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-50-v3.yaml
virtualservice.networking.istio.io/reviews configured
浏览器访问测试
其他规则查看istio官网
https://istio.io/latest/docs/tasks/traffic-management/request-routing/