Version 1.11

Deploying the Online Boutique sample application

This guide explains how to install the Online Boutique sample application to demonstrate Anthos Service Mesh. If you haven't installed Anthos Service Mesh, see the installation guide.

Enabling sidecar auto-injection

To enable automatic sidecar injection (auto-injection) for the sample application, you have to add a revision label to the sample's namespace. The label that you add depends on whether you deployed managed Anthos Service Mesh or installed the in-cluster control plane. The revision label is used by the sidecar injector webhook to associate injected sidecars with a particular control plane revision.

In-cluster

  1. Create a namespace for the application:

    kubectl create namespace demo
    
  2. Use the following command to locate the label on istiod:

    kubectl -n istio-system get pods -l app=istiod --show-labels
    

    The output looks similar to the following:

    NAME                                READY   STATUS    RESTARTS   AGE   LABELS
    istiod-asm-1112-17-5788d57586-bljj4   1/1     Running   0          23h   app=istiod,istio.io/rev=asm-1112-17,istio=istiod,pod-template-hash=5788d57586
    istiod-asm-1112-17-5788d57586-vsklm   1/1     Running   1          23h   app=istiod,istio.io/rev=asm-1112-17,istio=istiod,pod-template-hash=5788d57586
    

    In the output, under the LABELS column, note the value of the istiod revision label, which follows the prefix istio.io/rev=. In this example, the value is asm-1112-17.

  3. Apply the revision label to the demo namespace. In the following command, REVISION is the value of the istiod revision label that you noted in the previous step.

    kubectl label namespace demo istio-injection- istio.io/rev=REVISION --overwrite
    

    You can ignore the message "istio-injection not found" in the output. That means that the namespace didn't previously have the istio-injection label, which you should expect in new installations of Anthos Service Mesh or new deployments. Because auto-injection fails if a namespace has both the istio-injection and the revision label, all kubectl label commands in the Anthos Service Mesh documentation include removing the istio-injection label.

Managed service mesh

  1. Create a namespace for the application:

    kubectl create namespace demo
    
  2. Apply the asm-managed-rapid revision label to the demo namespace:

    kubectl label namespace demo istio-injection- istio.io/rev=asm-managed-rapid --overwrite
    

    This label corresponds to the current managed Anthos Service Mesh release channel for the Anthos Service Mesh version.

    You can ignore the message "istio-injection not found" in the output. That means that the namespace didn't previously have the istio-injection label, which you should expect in new installations of Anthos Service Mesh or new deployments. Because auto-injection fails if a namespace has both the istio-injection and the revision label, all kubectl label commands in the Anthos Service Mesh documentation include removing the istio-injection label.

  3. If you also deployed the optional Google-managed data plane, annotate the demonamespace as follows:

    kubectl annotate --overwrite namespace YOUR_NAMESPACE \
    mesh.cloud.google.com/proxy='{"managed":"true"}'
    

Downloading and deploying the sample

Now that auto-injection is enabled on the demo namespace, when you deploy the BookInfo application's services, sidecar proxies are injected alongside each service.

  1. Install kpt if you haven't already:

    gcloud components install kpt
    
  2. Download the sample using kpt:

    kpt pkg get \
    https://github.com/GoogleCloudPlatform/microservices-demo.git/release \
    online-boutique
    
  3. Deploy the sample to the cluster:

    kubectl apply -n demo -f online-boutique
    
  4. Find the external IP address of the frontend-external service:

    kubectl get service frontend-external -n demo
    
  5. Visit the application on your browser to confirm installation:

    http://EXTERNAL_IP/
    

For GKE, you can explore the Anthos Service Mesh observability features in the Cloud Console. Note that it can take up to 10 minutes for the topology graph to display the services in your mesh.

When you're finished exploring, remove the Online Boutique sample:

kubectl delete namespaces demo