Home

Awesome

Multi-cluster Cloud-Native grpc (microservices) application demo

This tutorial demonstrates how to deploy the Online Boutique microservices demo application across multiple Kubernetes clusters that are located in different public and private cloud providers. This project contains a 10-tier microservices application developed by Google to demonstrate the use of technologies like Kubernetes.

In this tutorial, you will create a Virtual Application Network that enables communications across the public and private clusters. You will then deploy a subset of the application's grpc based microservices to each cluster. You will then access the Online Boutique web interface to browse items, add them to the cart and purchase them.

Top complete this tutorial, do the following:

Prerequisites

The basis for this demonstration is to depict the deployment of member microservices for an application across both private and public clusters and for the ability of these microsservices to communicate across a Virtual Application Network. As an example, the cluster deployment might be comprised of:

While the detailed steps are not included here, this demonstration can alternatively be performed with three separate namespaces on a single cluster.

Step 1: Set up the demo

  1. On your local machine, make a directory for this tutorial and clone the example repo:

    mkdir boutique-demo
    cd boutique-demo
    git clone https://github.com/skupperproject/skupper-example-grpc.git
    
  2. Prepare the target clusters.

    1. On your local machine, log in to each cluster in a separate terminal session.
    2. In each cluster, create a namespace to use for the demo.
    3. In each cluster, set the kubectl config context to use the demo namespace (see kubectl cheat sheet for more information)
    kubectl config set-context --current --namespace <namespace>
    

Step 2: Deploy the Virtual Application Network

On each cluster, using the skupper tool, define the Virtual Application Network and the connectivity for the peer clusters.

  1. In the terminal for the first public cluster, deploy the public1 application router. Create a connection token for connections from the public2 cluster and the private1 cluster:

    skupper init --site-name public1
    skupper token create public1-token.yaml --uses 2
    
  2. In the terminal for the second public cluster, deploy the public2 application router, create a connection token for connections from the private1 cluser and connect to the public1 cluster:

    skupper init --site-name public2
    skupper token create public2-token.yaml
    skupper link create public1-token.yaml
    
  3. In the terminal for the private cluster, deploy the private1 application router and define its connections to the public1 and public2 cluster

    skupper init --site-name private1
    skupper link create public1-token.yaml
    skupper link create public2-token.yaml
    
  4. In each of the cluster terminals, verify connectivity has been established

    skupper link status
    

Step 3: Deploy the application microservices

After creating the Virtual Application Network, deploy the grpc based microservices for the Online Boutique application. There are three deployment .yaml files labelled a, b, and c. These files (arbitrarily) define a subset of the application microservices to deploy to a cluster.

DeploymentMicroservices
deployment-ms-a.yamlfrontend, productcatalog, recommendation
deployment-ms-b.yamlad, cart, checkout, currency, redis-cart
deployment-ms-c.yamlemail, payment, shipping
  1. In the terminal for the private1 cluster, deploy the following:

    kubectl apply -f skupper-example-grpc/deployment-ms-a.yaml
    
  2. In the terminal for the public1 cluster, deploy the following:

    kubectl apply -f skupper-example-grpc/deployment-ms-b.yaml
    
  3. In the terminal for the public2 cluster, deploy the following:

    kubectl apply -f skupper-example-grpc/deployment-ms-c.yaml
    

Step 4: Expose the microservices to the Virtual Application Network

There are three script files labelled -a, -b, and -c. These files expose the services created above to join the Virtual Application Network. Note that the frontend service is not assigned to the Virtual Application Network as it is setup for external web access.

FileDeployments
expose-deployments-a.shproductcatalog, recommendation
expose-deployments-b.shad, cart, checkout, currency, redis-cart
expose-deployments-c.shemail, payment, shipping
  1. In the terminal for the private1 cluster, execute the following annotation script:

    skupper-example-grpc/expose-deployments-a.sh
    
  2. In the terminal for the public1 cluster, execute the following annotation script:

    skupper-example-grpc/expose-deployments-b.sh
    
  3. In the terminal for the public2 cluster, execute the following annotation script:

    skupper-example-grpc/expose-deployments-c.sh
    

Step 5: Access The Boutique Shop Application

The web frontend for the Online Boutique application can be accessed via the frontend-external service. In the terminal for the private1 cluster, start a firefox browser and access the shop UI.

/usr/bin/firefox --new-window  "http://$(kubectl get service frontend-external -o=jsonpath='{.spec.clusterIP}')/"

Open a browser and use the url provided above to access the Online Boutique.

Step 6: Run the load generator

The Online Boutique application has a load generator that creates realistic usage patterns on the website.

  1. In the terminal for the private1 cluster, deploy the load generator:

    kubectl apply -f skupper-example-grpc/deployment-loadgenerator.yaml
    
  2. In the terminal for the private1 cluster, observe the output from the load generator:

    kubectl logs -f deploy/loadgenerator
    
  3. In the terminal for the private1 cluster, stop the load generator:

    kubectl delete -f skupper-example-grpc/deployment-loadgenerator.yaml
    

Cleaning Up

Restore your cluster environment by returning the resources created in the demonstration. On each cluster, delete the demo resources and the skupper network:

  1. In the terminal for the private1 cluster, delete the resources:

    skupper-example-grpc/unexpose-deployments-a.sh
    kubectl delete -f skupper-example-grpc/deployment-ms-a.yaml
    skupper delete
    
  2. In the terminal for the public1 cluster, delete the resources:

    skupper-example-grpc/unexpose-deployments-b.sh
    kubectl delete -f skupper-example-grpc/deployment-ms-b.yaml
    skupper delete
    
  3. In the terminal for the public2 cluster, delete the resources:

    skupper-example-grpc/unexpose-deployments-c.sh
    kubectl delete -f skupper-example-grpc/deployment-ms-c.yaml
    skupper delete
    

Next Steps