Siddhi Kubernetes Operator Intro

What is Siddhi?

Siddhi is an open source, complex event processing engine.

What is Siddhi Operator?

Siddhi operator enables the deployment of Siddhi apps directly in your kubernetes cluster using a kubernetes custom resource. Siddhi operator is a kubernetes custom controller which developed for deploy and manage siddhi apps in a kubernetes cluster. This blog refers to the initial release of the siddhi operator which is v0.1.0 version.

Prerequisites

You only need a kubernetes cluster such as,

How to Run a Siddhi App?

Here I explain how to install a simple siddhi app in your minikube cluster using the siddhi operator. First, you have to start the minikube cluster using the minikube start command. Then you have to enable ingress using the following command.

minikube addons enable ingress

After that, clone the siddhi operator repo and run the following commands.

If you correctly installed the siddhi operator you can see deployments as follow.

Here, siddhi-operator is the actual operator deployment and the siddhi-parser is the service which used to parse siddhi apps before deployments. Siddhi parser is only for internal usage of the siddhi operator logic. You don’t need to worry about that.

The next step is to install the custom object. So, use the following YAML file.

Save this YAML as monitor-app.yaml. Then use the following command to deploy the custom object.

If it successfully deployed you can see kubernetes deployment, service, and ingress as follow.

After that, you have to get the minikube IP and add siddhi host into your /etc/hosts file along with the minikube IP because by default siddhi operator creates an ingress and that ingress use siddhi as the host.

Then execute the following POST request to the siddhi app(monitor-app) you deployed.

curl -X POST \
https://siddhi/monitor-app/8280/example \
-H 'Content-Type: application/json' \
-d '{
"type": "monitored",
"deviceID": "001",
"power": 341
}'

When you see the logs of the deployment pod of the monitor-app, it should show the request as follow.

Bravo, you deployed an run a siddhi app successfully using the siddhi operator.

How to contribute?

  • You can directly raise issues and contribute to the siddhi-operator repository from here.
  • Contribute to siddhi distribution
  • Here is the siddhi organization