Deploy MuleSoft application in Kubernetes


This is an experimental post trying to explain how Mule applications can be deployed in Kubernetes easily. Well, this is not a production-grade deployment architecture but if anyone plans can extend it. Let's say, there is a need to deploy Mule applications in OpenShift.

In other words, if you prefer a container platform for MuleSoft you should definitely go for the Runtime Fabric. It's nothing but running Mule applications in containers.


Please find the deployment scripts in the github.

My Setup

Well, I have the most basic installation for the experiment. I installed Minikube in a CentOS VM (Just to don't bug my Mac) :). You can find the MiniKube installation guide here.

Mule Application

It's a simple application that returns the IP address of the host where Mule runtime runs. Or it can be any application of your choice. I will not dig too much into the application that I am going to deploy in k8s.

Application Packing

Once our application is implemented just build it. The output of the deployable artifact is a .jar file. After that is in hand, we can proceed to the next steps.

Dockerizing the application

If you have checked my previous article regarding CloudHub, there I showed you that each mule application is deployed in a single worker node (EC2 instance) in AWS. Or there is a one-to-one mapping between a mule application and the target host.

For this quick demo, I made the simplest possible Dockerfile. What I am doing in the Dockerfile are:

Installing the Mule ESB runtime

Deploying my mock Mule application to the Mule ESB.

That's it and no more balls & bells.

Docker file

Kubernetes Resources

I have created three k8s resources. a) deployment, b) service, c) Ingress

Check the below article on how to enable Ingress in MiniKube.

Below is my final YAML configuration (all-in-one).


That's it and we are done.


After deploying the above-cited resources in MiniKube, you can check them out.

Get all in the mule namespace

Now let's check my ingress:


Note that I have edited my /etc/hosts file to add a host for

Etc Hosts

Now our ingress should respond when we invoke it. Let's do it.


The curl has returned the IP address of the pod where the Mule application is deployed.

Now, you may ask, can we deploy more than one application in the same pod?

The answer is definitely yes.But, it will have its own disadvantages. The anwer is upto you to find it out.


In this article, I have explained how easily a Mule application can be deployed in k8s. But, I found some concerns regarding running the Mule runtime in the container. Note that, the Mule ESB is managed by a wrapper. The wrapper itself is responsible for monitoring e.g JVM, CPU, etc. The wrapper (Tanuki) manages the runtime lifecycle and NOT the k8s platform.

Also, the size of the Docker image (with the Mule runtime inside) is too large just to run one single Mule application. Or is there a possibility to optimize the Mule runtime, let's say by running some scripts we can bundle only the necessary modules of the runtime? Kind of a Micro Mule ESB.

So, let me know if you have faced such types of business use cases.

Happy learning!



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