destinationrule异常值检测

[root@k8s-master 13-outlier-detection]# kubectl apply -f destinationrule-demoapp.yaml 
destinationrule.networking.istio.io/demoapp configured
[root@k8s-master 13-outlier-detection]# cat destinationrule-demoapp.yaml 
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: demoapp
spec:
  host: demoapp
  trafficPolicy:
    loadBalancer:
      simple: RANDOM
    connectionPool:
      tcp:
        maxConnections: 100
        connectTimeout: 30ms
        tcpKeepalive:
          time: 7200s
          interval: 75s
      http:
        http2MaxRequests: 1000
        maxRequestsPerConnection: 10
    outlierDetection:
      maxEjectionPercent: 50
      consecutive5xxErrors: 5
      interval: 10s 
      baseEjectionTime: 1m
      minHealthPercent: 40
  subsets:
  - name: v10
    labels:
      version: v1.0
  - name: v11
    labels:
      version: v1.1

循环访问

while true;do curl demoapp:8080/livez; sleep 0.$RANDOM; done

将demoapp其中一个pod设置为FAIL

curl -X POST -d 'livez=FAIL' 10.244.36.97:8080/livez

检测有5次失败后会自动将异常的弹出

 

posted @ 2022-08-22 17:28  Maniana  阅读(35)  评论(0编辑  收藏  举报