This page explains how to deploy a sample application to Anthos Service Mesh. If you haven't installed Anthos Service Mesh, see the Installation guides section to choose the guide that is right for you.
Several sample applications come with the Anthos Service Mesh the installation. This
guide walks you through deploying the
BookInfo sample. This is a simple
mock bookstore application made up of four services that provide a web product
page, book details, reviews (with several versions of the review service), and
ratings—all managed using Anthos Service Mesh. You can find the source code and all
the other files used in this example in your Anthos Service Mesh installation's
Deploying the application
Use the following steps to deploy the BookInfo application's services with the sidecar proxies injected alongside each service.
On the command line on the computer where you installed Anthos Service Mesh, go to the root of the Anthos Service Mesh installation directory.
Label the namespace that will host the application with
kubectl label namespace default istio-injection=enabled
Deploy your application using
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
Confirm that the application has been deployed correctly by running the following commands:
kubectl get servicesOutput:
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE details 10.0.0.31 <none> 9080/TCP 6m kubernetes 10.0.0.1 <none> 443/TCP 7d productpage 10.0.0.120 <none> 9080/TCP 6m ratings 10.0.0.15 <none> 9080/TCP 6m reviews 10.0.0.170 <none> 9080/TCP 6m
kubectl get podOutput:
NAME READY STATUS RESTARTS AGE details-v1-1520924117-48z17 2/2 Running 0 6m productpage-v1-560495357-jk1lz 2/2 Running 0 6m ratings-v1-734492171-rnr5l 2/2 Running 0 6m reviews-v1-874083890-f0qf0 2/2 Running 0 6m reviews-v2-1343845940-b34q5 2/2 Running 0 6m reviews-v3-1813607990-8ch52 2/2 Running 0 6m
Finally, define the ingress gateway routing for the application:
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
Validating the application deployment
To see if the BookInfo application is working, you need to send traffic to the ingress gateway.
If you installed Anthos Service Mesh on Anthos clusters on VMware, get the external IP address for the ingress gateway that you configured after installing Anthos Service Mesh
If you installed Anthos Service Mesh on GKE, get the external IP address of the ingress gateway as follows:
kubectl get svc istio-ingressgateway -n istio-systemOutput:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE istio-ingressgateway LoadBalancer 10.19.247.233 220.127.116.11 80:31380/TCP,443:31390/TCP,31400:31400/TCP 27m
In this example, the IP address of the ingress service is
Trying the application
Check that the BookInfo app is running with
curl -I http://EXTERNAL_IP/productpage
If the response shows
200, it means the application is working properly with Anthos Service Mesh.
To view the BookInfo web page, enter the following address in your browser
If you refresh the page several times, you should see different versions of reviews shown in the product page, presented in a round robin style (red stars, black stars, no stars).
Now that you have an application that is generating traffic, you can explore the Anthos Service Mesh pages in the Cloud Console to see metrics and the other observability features.
When you are finished experimenting with the Bookinfo sample, remove it from your cluster.
Uninstall Bookinfo using the following script:
kubectl get services
kubectl get pods
The Bookinfo pods should be deleted.