To install the bookinfo
sample application, two primary steps are required: first, deploying the application itself, and second, setting up a gateway to make it accessible from outside the cluster.
The bookinfo
application serves as a tool for exploring the features of a service mesh. It allows you to easily verify that web browser requests are correctly routed through the mesh to the application.
The bookinfo
application presents information about a book, much like a single entry in an online bookstore's catalog. It shows a page with a book description, its details (such as ISBN and page count), and customer reviews.
When exposed through the mesh, the behavior of the bookinfo
application's microservices is governed by the mesh configuration. The review data is sourced from one of three services: reviews-v1
, reviews-v2
, or reviews-v3
. If you deploy bookinfo
without a defined reviews
virtual service, the mesh defaults to a round-robin policy for routing requests to these services.
By creating a reviews
virtual service, you can define custom routing rules. For instance, you could configure the mesh to direct requests to the reviews-v2
service when a user is logged in, which would display reviews with black stars. Conversely, for users who are not logged in, the mesh could route requests to reviews-v3
, showing reviews with red stars.
Additional details can be found in the upstream Istio documentation for the Bookinfo Application.
Use the following command to Create a new namespace named bookinfo
:
Enable sidecar injection for the bookinfo
namespace. If your setup uses the InPlace
upgrade strategy, run this command:
If you are using the RevisionBased
upgrade strategy, execute these commands:
To discover your <revision-name>
, run the following:
Sample output:
Label the namespace using the revision name to enable sidecar injection:
Optional : If you have already configured discoverySelectors
, use the following command to apply the Istio discovery selector
to the bookinfo
namespace:
Example discovery selector
label: istio-discovery=enabled
Deploy the bookinfo
application by applying its YAML file with the following command:
To confirm the bookinfo
service is available, run this command:
Example output
To check that the bookinfo
pods are available, execute the following command:
Example output
A successful proxy sidecar injection is indicated when the Ready
column shows 2/2
. Ensure the Status
column for each pod shows Running
.
Confirm the bookinfo
application is running by sending a request to its product page
. Execute this command:
Example output
Gateways are not deployed by the Alauda Service Mesh v2 Operator because they are not considered part of the control plane. For security, it is a best practice to deploy Ingress and Egress gateways in a separate namespace from the control plane.
There are two methods for deploying gateways: using the Gateway API or the gateway injection technique.
The gateway injection technique leverages the same mechanism as Istio sidecar injection. It creates a gateway from a Deployment
resource that is associated with a Service
resource. This Service
can then be exposed outside the Alauda Container Platform cluster.
Execute the following command to create the istio-ingressgateway
deployment and service:
Configure the bookinfo
application to use the newly created gateway by running this command:
This example uses a sample gateway configuration file to set up gateway injection for the bookinfo
application. The file must be applied in the same namespace where the application is installed.
Optional : Modify the YAML file for automatic pod scaling based on ingress traffic.
Example configuration
5
and the minimum to 2
. A new replica is created when CPU utilization hits 80%.Optional : Define the minimum number of pods that should be running on the node.
Example configuration
You will connect to the Bookinfo productpage
service through the gateway you just provisioned. To access the gateway, you need to use the kubectl port-forward
command:
http://localhost:9080/productpage
in your browser.--address 0.0.0.0
, replace localhost
with the remote host's IP or hostname (for example http://<REMOTE_HOST_IP>:9080/productpage
)When you refresh the page several times, you should see different versions of reviews shown in productpage
, presented in a round robin style (red stars, black stars, no stars), since we haven't yet used Istio to control the version routing.
With the Kubernetes Gateway API, a gateway is deployed through the creation of a Gateway
resource.
LoadBalancer
)Create and configure a gateway with the Gateway
and HTTPRoute
resources by executing the command below:
This example uses a sample gateway configuration file to configure a gateway for the bookinfo
application via the Gateway API. This file must be applied in the application's namespace.
Ensure the Gateway API service is ready and has an address by running the following command:
Retrieve the host with this command:
Retrieve the port with this command:
Retrieve the gateway URL with this command:
Get the full URL for the product page by running the following command:
Confirm that the productpage is accessible with the curl
command:
Example output
Confirm that the productpage is accessible in a web browser.
Point your browser to http://${GATEWAY_URL}/productpage
to view the Bookinfo web page.
When you refresh the page several times, you should see different versions of reviews shown in productpage
, presented in a round robin style (red stars, black stars, no stars), since we haven't yet used Istio to control the version routing.