virtualservice故障注入
[root@k8s-master 08-fault-injection]# kubectl apply -f virtualservice-demoapp.yaml
virtualservice.networking.istio.io/demoapp configured
[root@k8s-master 08-fault-injection]# cat virtualservice-demoapp.yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: demoapp
spec:
hosts:
- demoapp
http:
- name: canary
match:
- uri:
prefix: /canary
rewrite:
uri: /
route:
- destination:
host: demoapp
subset: v11
fault:
abort:
percentage:
value: 20 #20%注入流量故障,响应码555
httpStatus: 555
- name: default
route:
- destination:
host: demoapp
subset: v10
fault:
delay:
percentage:
value: 20 #20%注入流量故障,延迟3s
fixedDelay: 3s
直接访问demoapp:8080会有延迟3秒的故障
直接访问demoapp:8080/canary会有中断故障