Apply a policy

Use a fault injection policy to inject a delay to the ratings app. A delay simulates an overloaded upstream service or network issues, and can help you build more resilient apps. Then, you can check out the policy and other Gloo resources in the Gloo UI.

Verify in-cluster routing

Before you apply a policy, verify that the productpage service can route to the ratings-v1 and ratings-v2 services within the same service mesh in cluster1.

  1. In a separate tab in your terminal, open the Bookinfo product page from your local host.

    1. Enable port-forwarding on the product page deployment.
      kubectl -n bookinfo port-forward deployment/productpage-v1 9080:9080
    2. Open your browser to http://localhost:9080/productpage?u=normal.
  2. Refresh the page a few times to see the black stars in the Book ratings column appear and disappear. The presence of black stars represents ratings-v2 and the absence of stars represents ratings-v1, and the presence of red stars represents ratings-v3.

Apply fault injection

  1. Create a temporary curl or debug pod and send a request to the ratings app from your local machine. The communication from your local machine to the ratings app is allowed because no access policy is applied yet.

    Use the kubectl debug command to create an ephemeral curl container in the deployment. This way, the curl container inherits any permissions from the app that you want to test. If you don't run Kubernetes 1.23 or later, you can deploy a separate curl pod or manually add the curl container as shown in the other tab.

    kubectl -n bookinfo debug -i pods/$(kubectl get pod -l app=ratings -A -o jsonpath='{.items[0]}') --image=curlimages/curl -- curl http://ratings:9080/ratings/1

    Example output:

    HTTP/1.1 200 OK

    If the output has an error about EphemeralContainers, see Ephemeral containers don’t work when testing Bookinfo.

    Create a temporary curl pod in the bookinfo namespace, so that you can test the app setup. You can also use this method in Kubernetes 1.23 or later, but an ephemeral container might be simpler, as shown in the other tab.

    1. Create the curl pod.

      kubectl run -it -n bookinfo curl \
        --image=curlimages/curl:7.73.0 --rm  -- sh
    2. Send a request to the ratings app.

      curl http://ratings:9080/ratings/1

      Example output:

    3. Exit the temporary pod. The pod deletes itself.


  2. Create a fault injection policy to delay responses from the ratings app by 10 seconds, and a route table specifically for testing access to the ratings app.

    kubectl apply -f- <<EOF
    kind: FaultInjectionPolicy
      name: faultinjection-basic-delay
      namespace: bookinfo
        - route:
              route: ratings
          fixedDelay: 10s
    kind: RouteTable
      name: ratings-rt
      namespace: bookinfo
      - ratings
      - forwardTo:
          - ref:
              name: ratings
              namespace: bookinfo
          route: ratings
      - {}

  3. Send another request to the ratings app by using the same method as in step 1. Note that this time, the app's response is delayed due to the fault injection.

Launch the Gloo UI

The Gloo UI provides a single pane of glass through which you can observe the status of your service meshes, workloads, and services that run across all of your clusters. You can also view the policies that configure the behavior of your network.

  1. Access the Gloo UI.

    meshctl dashboard
  2. 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.
  3. 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 ratings 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.

To learn more about what you can do with the UI, see the Gloo UI guides.


Now that you have Gloo Mesh Enterprise up and running, check out some of the following resources to learn more about Gloo Mesh or try other Gloo Mesh features.


You can optionally remove the resources that you set up as part of this guide.
  1. Delete the fault injection policy and testing route table.

    kubectl delete FaultInjectionPolicy faultinjection-basic-delay -n bookinfo
    kubectl delete RouteTable ratings-rt -n bookinfo
  2. If you no longer need this quick-start Gloo Mesh environment, you can uninstall Istio resources, sample apps, and Gloo management and agent components by following the steps in Uninstall Gloo Mesh and Istio.