Taking KubeMQ Build & Deploy for a Test Drive: My Thoughts and Impressions
Tags: kubernetes, devops
Published: 2021-06-17 15:12:37


## Introduction

As a full-stack developer who often takes on DevOps and infrastructure responsibilities, the following happens all too frequently. 

**Problem:** I need to set up a backend server for my app!

**Solution:** Google it!

**Google result #1:** How to set up tech 1, tech 2, and tech 3 in just five minutes, for free!

(skip the prereqs because who needs those, follow the instructions, hit an error)

Hmm, let’s try that again…

(install all the prereqs, follow the instructions, hit another error)

Okay, maybe it’s just this article. Let’s try a different one.

**Google result #2:** Make your own tech 2 and tech 3 server using Docker and Kubernetes.

(follow the instructions, hit an error)

Well...maybe the third time’s the charm?

(day passes)

Guess I’ll try again in the morning…

While every tool promises to be simple to set up and use, the reality is that setting up infrastructure can be complex and unforgiving without the necessary experience. As such, I tend to shy away from instructions that consist of long lists of command-line operations, as more often than not they don’t work for me.

I’ve recently been exploring [KubeMQ](https://kubemq.io/), a Kubernetes-native message queue. They’ve recently released a new web-based configuration tool called [Build and Deploy](https://build.kubemq.io) which promises to make infrastructure setup as simple as filling in a form. 

In this article, I’ll cover what KubeMQ is, what Build and Deploy adds, and we’ll run through a test scenario with an API gateway and a Redis backend.


## What is KubeMQ?

KubeMQ is a Kubernetes-native messaging app that is extremely lightweight and easy to play with. Historically speaking, message queues are large, resource-intensive applications. For example, the latest version of IBM MQ at the time of writing has [significant hardware requirements](https://www.ibm.com/software/reports/compatibility/clarity-reports/report/html/softwareReqsForProduct?deliverableId=E3F333600B7F11EABCF401BE73544226&osPlatforms=Linux&duComponentIds=D005|S011|S006|S010|S008|S007|S009|A004|A003|A001|A002&mandatoryCapIds=16&optionalCapIds=30|341|47|12|9|1|25|20|28|184|185|70|16|15|26#!), such as > 1.5 GB disk space and 3 GB of RAM. In contrast, the Docker container for KubeMQ is roughly ~30 MB and installs on my local machine nearly instantly.

I’ve already written about how KubeMQ can simplify much of the complexity around [connecting microservice architectures](https://henryjin.dev/writing/microservice-messaging-in-kubernetes) as well as [communicating between multiple edge and cloud environments](https://henryjin.dev/writing/kubemq-bridges-for-edge-computing), so I won’t repeat all of that here. To summarize, because it is lightweight and Kubernetes-native, KubeMQ unlocks new possibilities that simply aren’t possible with legacy message queues.

So far, however, configuration has been a bit more difficult than I would like. [Documentation](https://docs.kubemq.io/) is somewhat sparse, and configuration happens via either the command line or YML files. There are [some examples online](https://github.com/kubemq-hub/kubemq-bridges/tree/master/examples), but without context, it can be difficult to modify them to fit my needs. Through my experience with KubeMQ, configuration has been the main point of friction.

Enter [KubeMQ Build & Deploy](https://build.kubemq.io/), which promises to make it simple to go from 0 to 100 with KubeMQ. Let’s take a look.


## What is KubeMQ Build & Deploy?

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xhr45dglnu7wagud5iwo.png)

[KubeMQ Build & Deploy](https://build.kubemq.io/) is a new web-based tool that generates KubeMQ configuration YML files. These can then be applied to your K8s cluster:


```
kubectl apply -f <insert URL or filename here>
```


Basically, it’s a GUI that allows you to skip the command-line configuration process. As an added bonus, the YML files can be saved and applied any number of times. And as your familiarity with the system grows, you can build upon them by editing them on your own.

All of these make KubeMQ Build & Deploy useful for a number of scenarios. Prototyping or trying to evaluate whether KubeMQ is for you? Build & Deploy makes that process significantly simpler, as you don’t need to learn YML in order to do so. 

Experienced already and need to build a complex production configuration? Create it in Build & Deploy, and then compare it to what you would have built manually to avoid unforeseen gaps in your infrastructure.

Enough talk, let’s take it for a spin.


## Try it out! A tutorial to connect API gateways and a Redis store

First, make sure that you have a local installation of Kubernetes (I’ll be using minikube on Windows) and a [free account with KubeMQ](https://account.kubemq.io/login/register). Second, make sure that you can successfully initialize KubeMQ:


```
kubectl apply -f https://deploy.kubemq.io/init
kubectl apply -f https://deploy.kubemq.io/key/<your key>
```


After a minute or two, check your pods; you should see something like the following:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8pck4qf5ru8nowt0bg91.png)

KubeMQ has created a basic three-node cluster for you, and as long as it’s all running we are ready to continue.

For reference in case you hit any issues, I’ve created a [GitHub repo](https://github.com/henryjin3/kubemq-build-deploy) with all of my YML files. That said, the whole point is to try out Build & Deploy, let’s keep going and do that!


### Set up the API Gateway

Next, head on over to [KubeMQ Build & Deploy](https://build.kubemq.io/). Since we already have the cluster, we need to configure the source (API gateway) as well as a target (Redis backend). Let’s start with the source:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xk6eais2rkmnac0qvrvq.png)

From there, in the top right search “API” and you should see the HTTP source.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9tu580nx77wo61i02rk.png)

Update the name, and let’s make it go from /redis to a KubeMQ Query channel called Redis. Your configuration should look as follows:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdu94ou4bjiqnyt9efbw.png)

Hit Save. Next, hit Deploy at the bottom right. Configure it to expose with a Node Port of 30000, and then hit “Get Deploy Manifests”.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z72lpbjgf8lmokynbmd9.png)

Click the link to automatically copy it to your clipboard. From there, paste it in your terminal and apply that configuration. If you want to take a look at the YML, simply copy the URL portion of the command and navigate to that URL in your browser. It should look like this:


```
apiVersion: core.k8s.kubemq.io/v1alpha1
kind: KubemqConnector
metadata:
  name: kubemq-sources
  namespace: kubemq
spec:
  config: |
    bindings:
    - id: 84691jbourwif3uk
      name: api-source
      properties: {}
      source:
        kind: http
        properties:
          methods: post
          path: /redis
      target:
        kind: kubemq.query
        properties:
          address: kubemq-cluster-grpc.kubemq:50000
          channel: redis
  node_port: 30000
  replicas: 1
  service_type: NodePort
  type: sources
```


Let’s continue and set up the Redis backend.


### Set up Redis

Since it’s not part of KubeMQ, Build & Deploy won’t generate the configuration for you. You can go ahead and download [this YML file](https://github.com/henryjin3/kubemq-build-deploy/blob/main/redis.yaml) from my GitHub which you can just apply. It should look like this:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e85l4znvinzbj96301e1.png)

Now that this is up, let’s wire it all together.


### Configure the Redis Target

Go back to the Build & Deploy homepage, and go to KubeMQ Targets:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f317do126iejzvu9s9xd.png)

Search and select Redis:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c38vjgis07pcn5tpn9ov.png)

Set the source as the KubeMQ Query “Redis” channel, and change the target connection string to “redis://redis-svc.redis:6379”.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x0jjkpdphjdxwscqyx4p.png)

Hit Save and then Deploy. We don’t need to change anything else, so just go ahead and hit “Get Deploy Manifests”, and apply the command.

To test it out, go ahead and run a POST. You can get the URL by running `minikube service list`:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/51t0w3hijn3vwdmz2c4u.png)

And then let’s do a POST. I’ll use Postman, although I’ve also provided some [sample cURL commands](https://github.com/henryjin3/kubemq-build-deploy/blob/main/curl_commands.txt).

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rs2gm287aog7s7u2oer3.png)

And you can do a get (this is a Redis get, not an HTTP GET):

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2n8fbp0emljy5ec2wupi.png)

You should get something like the following:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uoyuu91ppyyk55mfu7jc.png)

The result is a base64 byte array, which can be decoded at a site such as [this one](https://www.motobit.com/util/base64-decoder-encoder.asp):

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tn30j07ay9reswq9d6dl.png)

And that’s it! Via KubeMQ Build and Deploy, you’ve used KubeMQ and Kubernetes to set up a working link between an API gateway and a Redis backend. The best part is, these YML files can be applied in any Kubernetes cluster, making it easy to turn this prototype into a real production setup.

Below, I’ll share my overall impressions of this new product.


## Review and Impressions

Overall, my first experience with KubeMQ Build & Deploy has been really positive! Installing KubeMQ was always easy, and using a fully configured cluster was seamless and performant. 

Configuration used to be a bit of a black box. Now, Build & Deploy makes it a good bit more transparent and straightforward. Plus, going through the tool allows us to experience just how powerful KubeMQ itself is; the number of sources and targets that can be connected is quite high, and it makes me think of all the possibilities. In many cases, I think I could replace some simpler backend services with KubeMQ, and probably end up with something more performant and stable.

There are several small UI things that could be improved. For example, I wish there was a button to save YML files directly to my computer instead of doing it manually. I also wish there was an option to either save configurations to my account for later editing or even import YML files so that I could add to them via the browser. Right now, without that functionality, the tool is primarily useful for setting up new environments. That said, the tool is quite new and I expect these will be added with time.

For me, Build & Deploy significantly bridges the gap between installation and production, and I’m already thinking about how I can use this in my current and future projects. What about you?