Apply fault injection

Apply a fault injection policy to the reviews service to delay requests and simulate network issues or an overloaded service. A delay simulates an overloaded upstream service or network issues, and can help you build more resilient apps.

  1. Verify that you can successfully send requests to the reviews app.

      curl -vik --resolve www.example.com:80:$INGRESS_GW_IP http://www.example.com:80/reviews/1
      

    Example output:

      *   Trying 34.86.142.191:80...
    * Connected to 34.86.142.191 (34.86.142.191) port 80 (#0)
    > GET /reviews/1 HTTP/1.1
    > Host: 34.86.142.191
    > User-Agent: curl/7.79.1
    > Accept: */*
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    HTTP/1.1 200 OK
    
    ...
    
    < 
    * Connection #0 to host 34.86.142.191 left intact
    {"id": "1","podname": "reviews-v1-55b668fc65-kwvq5","clustername": "null","reviews": [{  "reviewer": "Reviewer1",  "text": "An extremely entertaining play by Shakespeare. The slapstick humour is refreshing!"},{  "reviewer": "Reviewer2",  "text": "Absolutely fun and entertaining. The play lacks thematic depth when compared to other plays by Shakespeare."}]}%   
      
  2. Create a fault injection policy to delay responses from the reviews app by 10 seconds.

      kubectl apply -f- <<EOF
    apiVersion: resilience.policy.gloo.solo.io/v2
    kind: FaultInjectionPolicy
    metadata:
      name: faultinjection-basic-delay
      namespace: bookinfo
    spec:
      applyToRoutes:
        - route:
            labels:
              route: reviews
      config:
        delay:
          fixedDelay: 10s
    EOF
      
  3. Send another request to the reviews app. Note that this time, the app’s response is delayed due to the fault injection.

      curl -vik --resolve www.example.com:80:$INGRESS_GW_IP http://www.example.com:80/reviews/1
      

Explore the UI

Use the Gloo UI to evaluate the health and efficiency of your Gloo Mesh Gateway environment.

  1. Open the Gloo UI. The Gloo UI is served from the gloo-mesh-ui service on port 8090. You can connect by using the meshctl or kubectl CLIs.

  • meshctl: For more information, see the CLI documentation.
      meshctl dashboard
      
  • kubectl:
    1. Port-forward the gloo-mesh-ui service on 8090.
        kubectl port-forward -n gloo-mesh svc/gloo-mesh-ui 8090:8090
        
    2. Open your browser and connect to http://localhost:8090.
  1. Review the Dashboard page, which presents an at-a-glance look at the health of workspaces and clusters that make up your Gloo setup.

    • In the Workspaces pane, you can review the workspace that was automatically created for you in your Gloo setup.
    • In the Clusters pane, you can review the workload clusters that are currently connected to your Gloo setup.
    Figure: Overview UI screenshot
    Figure: Overview UI screenshot
  2. Verify the details of the fault injection policy that you created in the previous section.

    1. Click the Resources tab to open the Solo resources page.
    2. In the row for your policy, faultinjection-basic-delay, click View Policy.
    3. Review the details of the policy, such as the reviews route that it applies to.
    4. Click View YAML.
    5. Scroll to the end of the YAML output to verify that the policy has a state of ACCEPTED.

Next steps

Now that you have Gloo Mesh Gateway up and running, check out some of the following resources to learn more about your API Gateway and expand your routing and network capabilities.

Gloo Mesh Gateway:

  • Monitor and observe your environment with Gloo Mesh Gateway’s built-in telemetry tools.
  • Customize your Gloo installation with a Helm-based setup.
  • When it’s time to upgrade Gloo Mesh Gateway, see the upgrade guide.

Traffic management:

Help and support:

Cleanup

You can optionally remove the resources that you set up as part of this guide.

  1. Delete the fault injection policy.

      kubectl delete FaultInjectionPolicy faultinjection-basic-delay -n bookinfo
      
  2. If you no longer need this quick-start Gloo Mesh Gateway environment, you can follow the steps in the uninstall guide.