--------------istio配置案例官方-------------------------------------
1.请求路由:
bin/istioctl create -f samples/bookinfo/routing/route-rule-all-v1.yaml
bin/istioctl replace -f samples/bookinfo/routing/route-rule-reviews-test-v2.yaml
https://istio.io/docs/tasks/traffic-management/request-routing/
2.流量分配:
bin/istioctl replace -f samples/bookinfo/routing/route-rule-reviews-50-v3.yaml
https://istio.io/docs/tasks/traffic-management/traffic-shifting/
3.请求超时:
https://istio.io/docs/tasks/traffic-management/request-timeouts/
将请求路由到reviews服务的v2 ,即调用ratings服务的版本
cat <apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
-
route:
-
destination:
host: reviews subset: v2
EOF
-
复制
为ratings服务调用添加2秒延迟:
cat <apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings
spec:
hosts:
- ratings
http: -
fault:
delay:percent: 100 fixedDelay: 2s
route:
-
destination:
host: ratings subset: v1
EOF
-
在浏览器中打开Bookinfo URL(http:// $ GATEWAY_URL / productpage)
您应该看到Bookinfo应用程序正常工作(显示评级星标),但每次刷新页面时都会有2秒的延迟。
现在为reviews服务调用添加1秒的请求超时
cat <apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http: -
route:
-
destination:
host: reviews subset: v2
timeout: 1s
EOF
-
4.网关
https://istio.io/docs/tasks/traffic-management/ingress/
5.网关https
https://istio.io/docs/tasks/traffic-management/secure-ingress/
6.访问外部请求
https://istio.io/docs/tasks/traffic-management/egress/
7.访问外部请求https
https://istio.io/docs/tasks/traffic-management/egress-tls-origination/
8.访问外部请求网关
https://istio.io/docs/tasks/traffic-management/egress-gateway/
9.断路器
https://istio.io/docs/tasks/traffic-management/circuit-breaking/
10.故障注入测试
https://istio.io/docs/tasks/traffic-management/fault-injection/