Deploying the Bookinfo application in ambient mode
You can deploy the Bookinfo sample application in ambient mode without sidecar injection by relying on the ZTunnel proxy. For background on the Bookinfo application, see Deploying the Bookinfo Application.
TOC
Deploying the Bookinfo ApplicationPrerequisitesProcedureVerificationAccessing the Bookinfo Application via a GatewayPrerequisitesProcedureVerificationCleanupAdditional resourcesDeploying the Bookinfo Application
Prerequisites
- An active ACP CLI (
kubectl) session by a cluster administrator with thecluster-adminrole. - You have
istioctlinstalled locally so that you can use to run these instructions. - Alauda Service Mesh Operator 2.1.1 or later is installed the Istio resource has been created, and the Operator has deployed Istio.
- An
IstioCNIresource has been created, and the Operator has deployed the requiredIstioCNIpods. - A
ZTunnelresource has been created, and the Operator has deployed the requiredZTunnelpods.
Procedure
-
Create the
bookinfonamespace: -
Add the
istio-discovery=enabledlabel to thebookinfonamespace: -
Deploy the
Bookinfoapplication:Apply the
bookinfo-versionsYAML file to create multiple versions of theBookinfoservices: -
Enroll the Bookinfo application in the ambient mesh by labeling either the entire namespace or individual pods:
-
To include all workloads in the
bookinfonamespace: -
To include only specific workloads, apply the
istio.io/dataplane-mode=ambientlabel directly to individual pods. See the Additional resources section for details on the labels used to add or exclude workloads from the mesh.NOTEEnrolling workloads in the ambient mesh does not require restarting or redeploying application pods. Unlike sidecar mode, the number of containers in each pod remains unchanged.
-
Verification
-
To confirm the
bookinfoservices are available, run this command:Example output
-
To check that the
bookinfopods are available, execute the following command:Example output
Because ambient mode does not inject a proxy sidecar, the
Readycolumn shows1/1. Ensure theStatuscolumn for each pod showsRunning. -
Confirm the
bookinfoapplication is running by sending a request to itsproduct page. Execute this command:Example output
-
Confirm that the ZTunnel proxy has successfully established listening sockets in the pod network namespaces:
After adding
bookinfonamespace to the Ambient mesh, you would seeHBONEprotocol.Example output
Accessing the Bookinfo Application via a Gateway
Gateways are not deployed by the Alauda Service Mesh v2 Operator because they are not considered part of the control plane. In ambient mode, the Kubernetes Gateway API is the only supported way to configure ingress traffic: a gateway is deployed through the creation of a Gateway resource, and the routing rules are defined with an HTTPRoute resource.
In ambient mode, VirtualService resources have limited compatibility and should not be combined with Gateway API configuration. Use Kubernetes Gateway API resources as the standard approach for traffic routing in ambient mode.
Prerequisites
- The
bookinfoapplication is deployed and enrolled in the ambient mesh, as described in the previous procedure. - Gateway API CRDs are installed.
- Your Kubernetes cluster supports external load balancers (i.e., Services of type
LoadBalancer).
Procedure
-
Add the
istiogateway class overlay to theIstioresource so that the gateway pod is admitted into theRestrictedbookinfonamespace:For more information, see Pod Security Admission.
-
Create and configure a gateway with the
GatewayandHTTPRouteresources by executing the command below:NOTEThis example uses a sample gateway configuration file to configure a gateway for the
bookinfoapplication 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:
INFOIf
$INGRESS_HOSTis an IPv6 address, enclose it in square brackets when constructing the URL. For example: -
Get the full URL for the product page by running the following command:
Verification
-
Confirm that the productpage is accessible with the
curlcommand:Example output
-
Confirm that the productpage is accessible in a web browser.
Point your browser to
http://${GATEWAY_URL}/productpageto 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.
Cleanup
When you are finished exploring the Bookinfo application, remove the application and all of its associated gateway resources by deleting the bookinfo namespace: