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.
apiVersion: apps/v1
kind: Deployment
metadata:
name: thrift-sample-server-fake
namespace: meta-thrift
labels:
app: thrift-sample-server
spec:
selector:
matchLabels:
app: thrift-sample-server
replicas: 1
metadata:
annotations:
sidecar.istio.io/proxyImage: aeraki/meta-protocol-proxy:1.0.1
sidecar.istio.io/rewriteAppHTTPProbers: "false"
labels:
app: thrift-sample-server
spec:
containers:
- name: thrift-sample-server
image: nginx
ports:
- containerPort: 9090
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:
kubectl apply -f- <<EOF
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
namespace: meta-thrift
spec:
host: thrift-sample-server
trafficPolicy:
outlierDetection:
baseEjectionTime: 15m
consecutive5xxErrors: 5
interval: 5m
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.
aerakictl_sidecar_stats client meta-thrift|grep -i outlier
cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_active: 1
cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_consecutive_5xx: 1
cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_detected_consecutive_5xx: 1
cluster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_enforced_consecutive_5xx: 1
luster.outbound|9090||thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_enforced_total: 1