--------------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 <<EOF | bin/istioctl replace -f -
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v2
EOF
复制
为ratings服务调用添加2秒延迟:
- destination:
cat <<EOF | bin/istioctl replace -f -
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings
spec:
hosts:
- ratings
http: - fault:
delay:
route:percent: 100 fixedDelay: 2s
- destination:
host: ratings
subset: v1
EOF
- destination:
在浏览器中打开Bookinfo URL(http:// $ GATEWAY_URL / productpage)
您应该看到Bookinfo应用程序正常工作(显示评级星标),但每次刷新页面时都会有2秒的延迟。
现在为reviews服务调用添加1秒的请求超时
cat <<EOF | bin/istioctl replace -f -
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http: - route:
- destination:
host: reviews
subset: v2
timeout: 1s
EOF
- destination:
4.网关
https://istio.io/docs/tasks/traffic-management/ingress/
6.访问外部请求
https://istio.io/docs/tasks/traffic-management/egress/
9.断路器
https://istio.io/docs/tasks/traffic-management/circuit-breaking/
10.故障注入测试
https://istio.io/docs/tasks/traffic-management/fault-injection/