Deploy WSO2 Stream Processor Fully Distributed Deployment in a Google Compute Engine, Kubernetes cluster from scratch

This tutorial explains how to deploy WSO2 Stream Processor Fully Distributed Deployment in a Google Compute Engine Kubernetes cluster. Tutorial is under two folds,

1. Configuring the infrastructure

2. Deploying the Kubernetes artifacts

Let’s start with configuring the infrastructure.

  1. Create a GCP Free Tire if you don’t already have a GCP account.
  2. Go to the Google cloud platform console and create a new project named wso2-sp-distributed.
  3. Enable Kubernetes compute engine for the project by selecting Kubernetes compute engine from the menu and clicking enable billing. You can find more details from here.
  4. Now install Gcloud: a command-line tool for managing the Google cloud platform. You can find the Quick-Start guide from here.
  • Let’s initialize the gcloud command-line tool by executing the following command in the terminal,
gcloud init
  • Accept the option to log in using your Google user account:
To continue, you must log in. Would you like to log in (Y/n)? Y
  • Log in to your account and grant permission.
  • Choose the project wso2-sp-distributed from the list.
 Which compute zone would you like to use as project default?
[1] [wso2-sp-distributed]

Please enter your numeric choice:1
  • Choose us-east1-b as the default region for the project,
Do you want to configure a default Compute Region and Zone? (Y/n)? Y

5. Next install kubectl: a command-line tool for managing Kubernetes clusters.

gcloud components install kubectl

Now you have installed necessary tools to deploy a Kubernetes cluster.

6. Create a Kubernetes cluster by executing following command,

gcloud container clusters create wso2-sp-distributed-kubernetes --machine-type=n1-standard-2 --zone=us-east1-b

7. Execute following command to configure kubectl for the wso2-sp-distributed-kubernetes cluster.

gcloud container clusters get-credentials wso2-sp-distributed-kubernetes

8. Enable Role based access control for the cluster

kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole cluster-admin --user <EMAIL>

Replace <EMAIL> with your Gmail address.

9. Deploy Ingress Controller by executing the following command,

kubectl apply -f --username admin --password $(gcloud container clusters describe wso2-sp-distributed-kubernetes | grep password | awk ‘{print $2}’) && kubectl apply -f

Now you have successfully deployed a Kubernetes cluster. You can get the cluster information using the following command,

gcloud container clusters describe wso2-sp-distributed-kubernetes

In the next few steps we are going to create a Network file system, required to share Siddhi files directory among the managers.

10. Go to the Launcher Dashboard and create a Single node file server in the zone us-east1-b with the name singlefs-1-wso2-sp and default settings.

Single node file server

11. Log in to the NFS instance to create the required directory.

  • Get the password of the instance
gcloud compute instances \
describe singlefs-1-wso2-sp-vm \
--zone=us-east1-b \
  • SSH into the instance,
gcloud compute --project “wso2-sp-distributed” ssh --zone “us-east1-b” “singlefs-1-wso2-sp-vm”

Enter the password obtained above when it is asked.

  • Mount the volume.

sudo mount -t nfs singlefs-1-wso2-sp-vm:/data /mnt
  • Create the following directory.
mkdir -p /data/pattern-distributed/siddhi-files
  • Set the file permission
sudo useradd -u 802 wso2carbon && \
sudo groupadd -g 802 wso2 && \
sudo chown -R wso2carbon:wso2 /data/pattern-distributed/

Now you have successfully configured the environment.

In the following steps we are going to deploy WSO2 Stream Processor Fully Distributed Deployment artifacts on the pre-configured cluster.

  1. Clone the wso2/kubernetes-sp repository and checkout the required tag.
git clone
git checkout v4.2.0.1

2. Update the Kubernetes Persistent Volume resource with the corresponding NFS server IP (NFS_SERVER_IP) and exported, NFS server directory path (NFS_LOCATION_PATH) in <KUBERNETES_HOME>/pattern-distributed/volumes/persistent-volumes.yaml.

You can get the private IP of the NFS server using following command,

gcloud compute instances describe singlefs-1-wso2-sp-vm --zone=us-east1-b --format=’value(networkInterfaces[0].networkIP)’

3. Go to the directory kubernetes-sp/pattern-distributed/scripts

cd kubernetes-sp/pattern-distributed/scripts

4. Execute the shell script on the terminal, with the appropriate configurations as follows:

./ --wso2-username=<WSO2_USERNAME> --wso2-password=<WSO2_PASSWORD> --cluster-admin-password=<K8S_CLUSTER_ADMIN_PASSWORD>

If you don’t have an active WSO2 subscription, subscribe for the Free Trail subscription.

5. Check whether the deployment is up and running,

kubectl get pods -n wso2 | awk ‘{print $2}’

Wait until the Ready status of the servers become from state 0/1 to 1/1.

6. Add /etc/hosts entry for the Host names.

  • Get the Host names and IP address
  • Add the above three host entries to /etc/hosts file.

7. Deploy Distributed Siddhi applications to the manager cluster using one of the following methods.

  • Dropping the .siddhi file in to the /data/pattern-distributed/siddhi-files in the NFS node directory before or after starting the manager node.
  • Sending a “POST” request to http://<host>:<port>/siddhi-apps, with the Siddhi App attached as a file in the request as shown in the example below. Refer Stream Processor REST API Guide for more information on using WSO2 Stream Processor APIs.

curl -X POST “https://wso2sp-manager-1/siddhi-apps" -H “accept: application/json” -H “Content-Type: text/plain” -d @TestSiddhiApp.siddhi -u admin:admin -k

8. Access Status Dashboard.

Try navigating to https://wso2sp-dashboard/monitoring from your favorite browser.

Add both managers to the dashboard using the below info.

Resource nodes that are registered with the active manager will be automatically added.

Stream Processor Status Dashboard — Distributed View