I would like to use the fault injection mechanism of Istio.
I have been task to add a timeout of 5 second on a service. So to achieve this I made my own virtual service which follows:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: hello
namespace: default
spec:
hosts:
- hello-service.default.svc.cluster.local
http:
- fault:
delay:
percent: 100 #Applies on all request
fixedDelay: 5s #Timeout of 5 sec
route:
- destination:
host: hello-service.default.svc.cluster.local
As you can seen I only redirected the hello service on itself and applied the 5 second timeout. Unfortunatly the timeout isn't working at all...
This is the example from the documentation:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings
spec:
hosts:
- ratings
http:
- fault:
delay:
percent: 100
fixedDelay: 2s
route:
- destination:
host: ratings
subset: v1
What am I doing wrong ?
Thx for your help
Update 1 - Adding targeted service
apiVersion: v1
kind: Service
metadata:
name: hello-service
namespace: default
spec:
selector:
app: hello
ports:
- port: 80
targetPort: 9080
Update 2 - Adding output of proxy-config
$istioctl proxy-config route hello-75c874b67f-6l4p9
NOTE: This output only contains routes loaded via RDS.
NAME VIRTUAL HOSTS
80 6
3000 4
8060 1
8080 2
8088 1
9090 1
9091 2
9093 5
9411 1
15004 2
15010 1
15030 1
15031 1
20001 1
1
Adding this answer to give insight on the status of the issue.
With the help of @Sergii Bishyr I now know that the virtualService provided in my question is working.
I tested it with 2 simple applications curling from the first one to the second one. In this case the timeout is applied !
Unfortunatly on the original app where I was using the virtual service its still not working.
The test applications and the original one are both webservers so I'm not sure why in one case its working and not in the second one... The mystery is not yet solved.