Skip to main content
Contact Us 1-800-596-4880

Getting started with Anypoint Service Mesh: Google Cloud Platform

35 min read

Overview

Welcome to the Anypoint Service Mesh GCP tutorial. In this tutorial, we will walk you through the process of installing Anypoint Service Mesh on Google Cloud Platform. You will deploy a demo application and secure using Anypoint Service Mesh. To log issues, click here to go to the Github repository issue submission form. In order to successfully install Anypoint Service Mesh on GCP, you will need to create an Google Cloud Platform account and also have an Anypoint Platform Account. Click the button below to sign up for an Anypoint Platform account or log into your existing account.

Start free trial

Already have an account? Sign in.

Step 1: Create Google VPC

From any browser, go to the URL to access Google Cloud Console: https://console.cloud.google.com/ then click on the upper left navigation bar and select VPC networks.

vpc networks

Click Create a VPC network, then enter the name for the network and select Automatic for Subnet creation. Then click Create and wait for the network to be created.

automatic

service mesh network creation

Step 2: Create Kubernetes Cluster

Click on the upper left navigation bar. Select Clusters.

kubernetes cluster

Click Create Cluster and enter a name for your cluster.

cluster

Select Master Version of 1.16.x or higher.

cluster version

Click Networking and select your network created in previous step.

container

vpc

Click CREATE and wait of cluster to be created.

cluster

Step 3: Verify Cluster and Connect

From the Kubernetes Cluster page click Connect. From the Connect to the cluster popup copy the Command-line access command.

cluster

Open Terminal window. If you don’t already have the gcloud cli installed following the Google Docs to first install gcloud cli. Paste gcloud connect to cluster command from the previous step. Next run the following command to verify that you cluster is running.

kubectl get namespaces

connect cluster

Step 4: Download and Install Istio CLI

To install Istio we will be using the Istio CLI. For completed instructions Istio Docs. Use the following command to download Istio CLI into your directory of choice. In this example I am using directory /Users/dennis.foley/ASM

curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.7.2 sh -

bash

Change into the newly downloaded directory:

cd istio-1.7.2/

Then add the current directly to path:

export PATH=$PWD/bin:$PATH

Step 5: Install Istio using CLI

To install Istio we will be using the Istio CLI. From the istio directory run the following command. At the prompt Proceed? (Y/N) enter Y

istioctl install

iso

Verify that Istio has been installed. You should now see the istio-system namespace

kubectl get namespaces

get namespaces

Step 6: Clone Demo Application

For our demo application we will be using Mythical Retail shopping cart application. This web-based UI will call several services to complete the order. Clone the demo application git repository onto your local machine.

git clone https://github.com/mulesoft-consulting/ServiceMeshDemo

Change to the ServiceMeshDemo directory and list out the contents to verify that the repository has been created correctly

code

Step 7: Deploy Demo Application

We will now deploy the demo application to your kubernetes cluster. The deployment script takes the namespace as a parameter. We will be using mythical-payment for namespace.

./deployAll.sh mythical-payment

created

You can monitory the deployment with the following commands:

kubectl get pods -n mythical-payment
kubectl get services -n mythical-payment

Once all services are running you can test out the application. To access the application open you browser and go to the following URL

http://{external-ip}:3000

mythical retail

To test out the application follow these steps:

  • Select Item to purchase
  • Click Add to Cart
  • Click Checkout
  • Leave default email and click CONTINUE
  • Click AUTHORIZE PAYMENT
  • Last click PLACE ORDER

mythical retail

STEP 8: Install Anypoint Service Mesh

For complete instructions and documentation please visit MuleSoft Docs

curl -Ls http://anypoint.mulesoft.com/servicemesh/xapi/v1/install > asmctl && chmod +x asmctl

Now we are ready to install Anypoint Service Mesh. To do this we will call asmctl install. This command requires 3 parameters: Client Id, Client Secret, Service Mesh license.

If you are not familiar with how to get environment Client Id and Secret, navigate to API Manager and click on the Environment Information button.

install anypoint mesh

install anypoint mesh

Then run the following command to install asmctl:

./asmctl install

Next, verify that Anypoint Service Mesh has been installed correctly with the following command:

kubectl get pods -n service-mesh

install anypoint mesh

Step 9: Install Anypoint Service Mesh Adapter

Next, we want to deploy the Anypoint Service Mesh adapter in each namespace that we want to monitor API’s. For this example, we will just be doing the nto-payment namespace that contains the demo application. To deploy the ASM Adapter we will be using a Kubernetes custom resource definition (CRD). In the ServiceMeshDemo repository, we have created the file nto-payment-asm-adapter.yaml that can modified.

install adapter

Replace CLIENT ID and CLIENT SECRET with values for your environment. Save the file and run the following command

kubectl apply -f mythical-payment-asm-adapter.yaml

install adapter

Use the following command to monitor the progress. Wait for status to change to Ready:

asmctl adapter list

install adapter

Step 10: Create API’s

We will now use now use Anypoint Service Mesh auto discovery to create API’s in Anypoint Platform. We will create API’s for Customer, Inventory, Order and Payments services that are used by the demo application. Before creating the APIs, ensure the Anypoint Platform user has API Manager Environment Administrator permission, in addition to Manage APIs Configuration. This can be done by your organization admin in *Access Management.

create api

Modify the Kubernetes custom resource definition (CRD) file demo-apis.yaml. For each API, replace ENV ID, USER and PASSWORD with the values for your environment. If you are unsure how to get the environment ID check out this article. Save the file and run the following command (NOTE: If you run this multiple times you might need to change the version number since Anypoint Platform will keep it around for 7 days).

kubectl apply -f demo-apis.yaml

create api

Use the following command to monitor the progress. Wait for status to change to Ready:

asmctl api list

create api

You can also verify that the API’s have been created in Anypoint Platform by navigating to API Manager.

Step 11: Binding API’s with Services

The last step is to bind the Kubernetes Services with the Anypoint Platform API’s. To do this you will use the binding definition file demo-bind-apis.yaml. Execute the following command

kubectl apply -f demo-bind-apis.yaml

binding api

Use the following command to monitor the progress. Wait for status to change to Ready

asmctl api binding list

binding api

Congratulations, you have completed installing Anypoint Service Mesh on GCP. To read further, please visit the GitHub repo for instructions on setting up rate limiting and other policies.

Try Anypoint Platform for free

Start your 30-day free trial of the #1 platform for integration, APIs, and automation. No credit card required. No software to install.

Try for free

anypoint product trial zigzag