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
.
-
In a separate tab in your terminal, open the Bookinfo product page from your local host.
- Enable port-forwarding on the product page deployment.
kubectl -n bookinfo port-forward deployment/productpage-v1 9080:9080
- Open your browser to http://localhost:9080/productpage?u=normal.
- Enable port-forwarding on the product page deployment.
-
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 representsratings-v1
, and the presence of red stars representsratings-v3
.

Apply fault injection
-
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.
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.-
Create the curl pod.
kubectl run -it -n bookinfo curl \ --image=curlimages/curl:7.73.0 --rm -- sh
-
Send a request to the ratings app.
curl http://ratings:9080/ratings/1
Example output:
{"id":1,"ratings":{"Reviewer1":5,"Reviewer2":4}}
-
Exit the temporary pod. The pod deletes itself.
exit
Use the
kubernetes 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].metadata.name}') --image=curlimages/curl -- curl http://ratings:9080/ratings/1
Example output:
HTTP/1.1 200 OK ... {"id":1,"ratings":{"Reviewer1":5,"Reviewer2":4}}
If the output has an error about
EphemeralContainers
, see Ephemeral containers don’t work when testing Bookinfo. -
-
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 apiVersion: resilience.policy.gloo.solo.io/v2 kind: FaultInjectionPolicy metadata: name: faultinjection-basic-delay namespace: bookinfo spec: applyToRoutes: - route: labels: route: ratings config: delay: fixedDelay: 10s --- apiVersion: networking.gloo.solo.io/v2 kind: RouteTable metadata: name: ratings-rt namespace: bookinfo spec: hosts: - ratings http: - forwardTo: destinations: - ref: name: ratings namespace: bookinfo labels: route: ratings workloadSelectors: - {} EOF
-
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.
-
Access the Gloo UI.
meshctl dashboard
-
Review the Overview 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.
-
Verify the details of the fault injection policy that you created in the previous section.
- Click the Policies tab to open the Policy Rules page.
- Click the name of your policy,
faultinjection-basic-delay
. - Review the details of the policy, such as the
ratings
route that it applies to. - Click View YAML.
- Scroll to the end of the YAML output to verify that the policy has a
state
ofACCEPTED
.
To learn more about what you can do with the UI, see the Gloo UI guides.
Next
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.
- Browse Gloo Mesh traffic control and security policies to try out some of Gloo Mesh Enterprise's features.
- Check out the setup guide for advanced installation and cluster registration options.
- Talk to an expert to get advice or build out a proof of concept.
- Join the #gloo-mesh channel in the Solo.io community slack.
- Try out one of the Gloo Mesh workshops.
Cleanup
-
Delete the fault injection policy and testing route table.
kubectl delete FaultInjectionPolicy faultinjection-basic-delay -n bookinfo kubectl delete RouteTable ratings-rt -n bookinfo
-
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.