Bookinfo application

The upstream Istio project has an example tutorial called bookinfo, which is composed of four separate microservices used to demonstrate various Istio features. The Bookinfo application displays information about a book, similar to a single catalog entry of an online book store. Displayed on the page is a description of the book, book details (ISBN, number of pages and other information), and book reviews.

The Bookinfo application consists of four separate microservices:

  • The productpage microservice calls the details and reviews microservices to populate the page.

  • The details microservice contains book information.

  • The reviews microservice contains book reviews. It also calls the ratings microservice.

  • The ratings microservice contains book ranking information that accompanies a book review.

There are three versions of the reviews microservice:

  • Version v1 does not call the ratings Service.

  • Version v2 calls the ratings Service and displays each rating as one to five black stars.

  • Version v3 calls the ratings Service and displays each rating as one to five red stars.

Installing the Bookinfo application

The following steps describe deploying and running the Bookinfo tutorial on OpenShift Container Platform with Service Mesh 0.12.TechPreview.

  • OpenShift Container Platform 3.11 or higher installed.

  • Red Hat OpenShift Service Mesh 0.12.TechPreview installed.

Red Hat OpenShift Service Mesh implements auto-injection differently than the upstream Istio project, therefore this procedure uses a version of the bookinfo.yaml file annotated to enable automatic injection of the Istio sidecar.

  1. Create a project for the Bookinfo application.

    $ oc new-project myproject
  2. Update the Security Context Constraints (SCC) by adding the service account used by Bookinfo to the anyuid and privileged SCCs in the "myproject" Namespace:

    $ oc adm policy add-scc-to-user anyuid -z default -n myproject
    $ oc adm policy add-scc-to-user privileged -z default -n myproject
  3. Deploy the Bookinfo application in the "myproject" Namespace by applying the bookinfo.yaml file:

    $ oc apply -n myproject -f
  4. Create the ingress gateway for Bookinfo by applying the bookinfo-gateway.yaml file:

      $ oc apply -n myproject -f
  5. Set the value for the GATEWAY_URL parameter:

    $ export GATEWAY_URL=$(oc get route -n istio-system istio-ingressgateway -o jsonpath='{}')

Verifying the Bookinfo installation

Before configuring your application, verify that it successfully deployed.

  • To confirm that the application is deployed:

    • Run this command:

      $ curl -o /dev/null -s -w "%{http_code}\n" http://<GATEWAY_URL>/productpage
    • Alternatively, you can open http://<GATEWAY_URL>/productpage in your browser.

Adding default destination rules

Before you can use the Bookinfo application, you have to add default destination rules. There are two preconfigured yaml files, depending on whether or not you enabled mutual transport layer security (TLS) authentication.

  1. To add destination rules, run one of the following commands:

    • If you did not enable mutual TLS:

      $ oc apply -n myproject -f
    • If you enabled mutual TLS:

      $ oc apply -n myproject -f
  2. To list all available destination rules:

    $ oc get destinationrules -o yaml

Now that you have a sample application, you can use the other tutorials in this guide to examine your service mesh.

Removing the Bookinfo application

When you finish with the Bookinfo application, you can remove it by running the cleanup script.

Several of the other Service Mesh tutorials also use the Bookinfo application. Do not run the cleanup script if you plan to explore other Service Mesh tutorials.

  1. Download the cleanup script:

    $ curl -o && chmod +x ./
  2. Delete the Bookinfo virtualservice, gateway, and terminate the Pods by running the cleanup script:

    $ ./
    namespace ? [default] myproject
  3. Confirm shutdown by running these commands:

    $ oc get virtualservices -n myproject
    No resources found.
    $ oc get gateway -n myproject
    No resources found.
    $ oc get pods -n myproject
    No resources found.