How to configure circuit breaking

    After installation, you can see that the following two NSs have been added to the cluster, and the Dubbo and Thrift demo applications are installed in these two NSs. You can choose either of them to test.

    1. apiVersion: apps/v1
    2. kind: Deployment
    3. metadata:
    4. name: thrift-sample-server-fake
    5. namespace: meta-thrift
    6. labels:
    7. app: thrift-sample-server
    8. spec:
    9. selector:
    10. matchLabels:
    11. app: thrift-sample-server
    12. replicas: 1
    13. metadata:
    14. annotations:
    15. sidecar.istio.io/proxyImage: aeraki/meta-protocol-proxy:1.0.1
    16. sidecar.istio.io/rewriteAppHTTPProbers: "false"
    17. labels:
    18. app: thrift-sample-server
    19. spec:
    20. containers:
    21. - name: thrift-sample-server
    22. image: nginx
    23. ports:
    24. - containerPort: 9090
    25. EOF

    Now there are three endpoint in the thrift-sample-server service, among them the thrift-sample-server-fake deployment have no real thrift server, so the corresponding endpoint “172.19.0.102” can not handle client requests. From the client log, you can see that there is an error message once in every three requests:

    1. kubectl apply -f- <<EOF
    2. apiVersion: networking.istio.io/v1beta1
    3. kind: DestinationRule
    4. namespace: meta-thrift
    5. spec:
    6. host: thrift-sample-server
    7. trafficPolicy:
    8. outlierDetection:
    9. baseEjectionTime: 15m
    10. consecutive5xxErrors: 5
    11. interval: 5m
    12. EOF

    At this point, if you look at the output of the client, you can see that the client no longer sends requests to the failed endpoint “172.19.0.102” after the number of errors specified by the fusion rule.

    1. aerakictl_sidecar_stats client meta-thrift|grep -i outlier
    2. cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_active: 1
    3. cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_consecutive_5xx: 1
    4. cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_detected_consecutive_5xx: 1
    5. cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_enforced_consecutive_5xx: 1
    6. luster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_enforced_total: 1