Injecting HTTP abort faults

Now, we will test the resiliency of the microservice by introducing the http abort rule for the end user, jason, for the ratings microservice:

  1. View the following command:
# Script : 09-inject-http-abort-fault.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings
spec:
hosts:
- ratings
http:
- match:
- headers:
end-user:
exact: jason
fault:
abort:
percentage:
value: 100.0
httpStatus: 500
route:
- destination:
host: ratings
subset: v1
- route:
- destination:
host: ratings
subset: v1

In the preceding code, we are introducing an http fault abort of 500 for the  jason  user for the ratings service.

  1. Modify the ratings virtual service to inject an http abort for the test user jason:
$ kubectl -n istio-lab apply -f 09-inject-http-abort-fault.yaml
virtualservice.networking.istio.io/ratings configured
  1. Refresh the page and make sure that you log in as jason.
  2. You will notice the message Ratings service is currently unavailable, indicating that the httpStatus code 500 was injected when a call was made to the ratings service:

  1. Click (sign out) to log out as jason.
  2. You will see that the ratings service works, as usual, showing v2 of ratings.

This type of testing is very useful for viewing the runtime behavior of the application by using the http abort code for different services without impacting other users. This type of proactive testing, while the application is still in production, is an example of chaos testing and continuous engineering, which is fundamental to cloud-native computing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.140.108