Sailing Micro Integrator In Kubernetes

WSO2 Micro Integrator (MI) was introduced with the intention of running a lightweight ESB inside containers, so that the ESB concept can be used with the Microservice architecture. The lower startup time, the reduced product size and single configuration file helps the product to be run on the container based environments. Services now can be decoupled, and they can be run on independent Micro Integrator instances. Starting and stopping of instance happens instantaneously which helps administrators to swap newer versions of the services with a smaller downtime.

Since Micro Integrator is container native, you can easily deploy it in a Kubernetes environment. To create the artifacts you can use the Integration Studio. For demonstration purposes, I am going to use one of the sample scenario that I used in one of my previous blogs. I’ll be using Micro Integrator 4.0.0 which comes under WSO2 API Manager 4.0.0 umbrella. You can use my previous blog as a guide to create the Integration project in WSO2 Integration Studio.

  1. First you need to create a Kubernetes Exporter project in Integration Studio. You can right click on an existing weather integration project and select New -> Kubernetes Exporter.
  2. In the New Kubernetes Exporter dialog box that opens, enter a name for the Kubernetes exporter and other parameters as shown below.

Here you need to note a couple of things.

  • Select Generate K8s Artifacts for as Pure K8s Artifacts.
  • Give a suitable Integration name.
  • I am selecting the base image as WSO2 MI 4.0.0. You can choose whatever you want.
  • Target Image repository is where you want to push your image to. When you build and push the image it will use the docker daemon settings on your environments to push the image.
  • By default http, https ports are exposed in the Service file. If you want to export any additional ports, you can mention it under Expose port(s) section.
  • In our initial API, the API key was included in our mediation itself. It is not a good practice to include secret keys inside the container images. Hence I am going to read it as an Environment variable. You can define Environment variables under Environment variables section.

After you have filled everything, click on Finish.

3. Once you click on Finish, you can see that the Studio has generated the necessary artifacts we need to create a Kubernetes deployment.

4. Since we are going to read the API_KEY from environment variable, we need to change the property mediator inside the API as below. (Reminder: This API was created in a previous blog.). Remember to check the Expression icon, since this is an Expression.

get-property(‘env’,’API_KEY’)

5. Now we need to build and push the image to the Docker repository. Go back to the Kubernetes export project pom file, and check the box of the OpenWeatherIntegrationCompositeExporter to include it inside the Micro Integrator image. After that, click on the Build & Push button on the top right side corner of the Exporter page.

6. Once you have pushed the image to your Docker repository, you can go and deploy Kubernetes artifacts in your Kubernetes cluster. (I am running a minikube cluster in my local environment.)

  • Copy the integration_k8s.yaml and integration_data.yaml into a separate folder.
  • Run the following command to create the configMap which contains the Environment variables (Your API_KEY).
kubectl apply -f integration_data.yaml
  • Once it is successfully applied, you can go ahead and deploy the integration_k8s.yaml which contains the Deployment and the Service.
kubectl apply -f integration_k8s.yaml
  • Now if you run the following command, you can see that the deployment is up and running.
kubectl get deploy

That’s it. You have successfully deployed, Micro Integrator in a Kubernetes cluster in just a few minutes. You can continue to play with the deployment by changing the replica values and all.

--

--

--

Software Engineer (Integration) @wso2, Graduated from University of Moratuwa (Computer Science & Eng) and GSOCer @intermineorg

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Async token requests in $.ajax calls

Diagram Driven Infrastructure

SyslogDecode — a new open source library from Microsoft for processing Syslog messages

Balancing Powerup Spawns

xweather weather forecast

DataOps: Building A Next Generation Data Engineering Organization

C — Static libraries

CS371p Spring 2020: David Zhu-Thirteenth Entry

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arunan Sugunakumar

Arunan Sugunakumar

Software Engineer (Integration) @wso2, Graduated from University of Moratuwa (Computer Science & Eng) and GSOCer @intermineorg

More from Medium

Prometheus and Grafana for Kube Observability Monitoring

https://camo.githubusercontent.com/f14ac82eda765733a5f2b5200d78b4ca84b62559d17c9835068423b223588939/68747470733a2f2f63646e2e6a7364656c6976722e6e65742f67682f70726f6d6574686575732f70726f6d65746865757340633334323537643036396336333036383564613335626365663038343633326666643564363230392f646f63756d656e746174696f6e2f696d616765732f6172636869746563747572652e737667

Improving Kubernetes response for scale out

cargo ship facing a storm

Granting IAM permissions to pods in EKS using OIDC

Cloud-Native Journey Part 1: Defining Goals and Responsibilities

Picture of a light blue sky with clouds