超时控制
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ kubectl apply -f - <<EOF apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews spec: hosts: - reviews http: - route: - destination: host: reviews subset: v2 timeout: 0.5s 《《《《《《 EOF |
对应的envoy配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
"route": { "cluster": "outbound|9080|v2|reviews.istio-bookinfo.svc.cluster.local", "timeout": "0.500s", 《《《《《《《《《!!!! "retryPolicy": { "retryOn": "connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes", "numRetries": 2, "retryHostPredicate": [ { "name": "envoy.retry_host_predicates.previous_hosts" } ], "hostSelectionRetryMaxAttempts": "5", "retriableStatusCodes": [ 503 ] }, "maxGrpcTimeout": "0.500s" }, |
延迟控制设置策略
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$ kubectl apply -f - <<EOF 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 |
对应的envoy配置
1 2 3 4 5 6 7 8 9 10 |
"typedPerFilterConfig": { "envoy.fault": { "@type": "type.googleapis.com/envoy.config.filter.http.fault.v2.HTTPFault", "delay": { "fixedDelay": "1s", "percentage": { "numerator": 50 } } } |
文章评论