#详细参数看官网,我参数就不解释https://istio.io/latest/docs/reference/config/networking/destination-rule/cat << EOF > dr.yaml
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:name: my-testnamespace: demon
spec:host: my-app.demon.svc.cluster.localtrafficPolicy:connectionPool:http:http2MaxRequests: 10maxRequestsPerConnection: 15outlierDetection:baseEjectionTime: 10sconsecutive5xxErrors: 10interval: 10s
EOF
cat << EOF > demon.yaml
apiVersion: apps/v1
kind: Deployment
metadata:name: my-app
spec:replicas: 1selector:matchLabels:app: my-apptemplate:metadata:labels:app: my-appspec:containers:- name: my-appimage: nginx:latestports:- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:name: my-app
spec:type: NodePortselector:app: my-appports:- name: httpprotocol: TCPport: 80targetPort: 80
EOF
cat << EOF > ingress-dr.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: vmmm
spec:ingressClassName: nginxrules:- host: my-app.xxx.tophttp:paths:- path: /pathType: Prefixbackend:service:name: my-appport:number: 80
EOF
并发工具测试
hey -n 1000 -c 100 -m GET http://my-app.xxxxchangs.top/
# 1000 个并发 GET 请求,总共发送 100 个请求
查看日志