VS故障注入
1.VirtualService故障注入介绍
故障注入在vs的fault字段定义。
1.1.abort: 中断故障注入
percentage: 故障百分比--在value里指定具体数值,用于指定故障百分比,比如写100的话,则是所有访问都是故障
httpStatus:模拟错误,返回的错误代码
1.2.delay: 延迟故障注入
percentage: 故障百分比--在value里指定具体数值,用于指定故障百分比,比如写100的话,则是所有访问都是故障
fixedDelay:用于设置延迟多久回应
2.配置
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: myvs2
spec:
hosts:
- "bb.xiebo.pro"
gateways:
- mygw
http:
- fault:
#延时
#delay:
# percent: 100
# fixedDelay: 1s
#中断
abort:
percentage:
value: 100
httpStatus: 503
route:
- destination:
host: svc2
3.响应超时设置
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: myvs1
spec:
hosts:
- "aa.xiebo.pro"
gateways:
- mygw
http:
- route:
- destination:
host: svc1
timeout: 1s