KubeCon + CloudNativeCon North America Virtual | November 17-20, 2020 | Don’t Miss Out | Learn more

Kubernetes Message Queue

CNCF Member Blog

Guest post originally published in KubeMQ by Lior Nabat


Most enterprises are adopting Kubernetes as a result of the endless benefits it offers. It is adopted for seamless container management; it provides high scalability and enhances communication / messaging. It can also allow for the addition of many lifetime applications when building a microservice. This means enterprises can make lots of changes as the project expands with little effort

There is a high volume of traffic flow of messages in microservice architecture that is orchestrated by Kubernetes. Managing heavy traffic can pose major challenges, so enterprises have to give a lot of thought on how to effectively manage the heavy traffic in the system before deploying in Kubernetes. This implies that the operational and architecture requirements that are needed to support the production environment have gained significant focus. In a new microservice, each data model is disengaged from the rest of the system. But a project can grow bigger into thousands of microservices, which means the messaging traffic would grow into millions of messages every day. Therefore to achieve an effective messaging system between microservices, a robust communication mechanism must be adopted.

Some enterprises attempt to solve this communication gap in Kubernetes using a Point-To-Pont connectivity system such as REST. However, REST can create restrictions and other complications in the messaging structure of the services. If there is no proper messaging solution, then there would be a need to carry out maintenance each time requirements are changed. Carrying out frequent maintenance is expensive, time-consuming, and unreliable. This problem cannot be solved by REST because of the many restrictions that come with it.

To solve the problems in microservices architecture and Kubernetes, a messaging queue system must be deployed for effective management. A messaging queue system re-architects the stack and deploys a single focal point of communication for better communication. This ensures that each service communicates with the message queue broker in its own language. The message queue system would then deliver the messages to the services waiting for it.

Building a well-managed messaging solution

A messaging system cannot be effective if it is not native to Kubernetes. Enterprises must ensure that when building a message queue system, it is native to Kubernetes to leverage the advantages.

The advantages are:

  • Robust messaging queue system
  • Secured system
  • Low DevOps maintenance
  • Well-connected ecosystem for logging in Kubernetes
  • Rapid deployment

Message Queue advantages in Hybrid cloud solution

Deploying enterprise solutions on a hybrid cloud service offers flexibility, control, speed, agility, low cost, and total control. It also ensures that the enterprise can use on-premise and public cloud services concurrently. Flexibility to migrate from one solution to the order as cost and workload requirement changes is a big benefit. With a hybrid solution, enterprises can host their sensitive applications and workload on the private cloud solution while minor / less critical workloads, and the application would be hosted on the public cloud solution. Furthermore, with a private cloud service organizations pay for only the resources they use. These resources can be scaled up or down whenever needed. For hybrid clouds to run effectively, transparently, connect seamlessly, and interact, message queue must be deployed in Kubernetes.

Use Cases

Message queues support a diversified messaging pattern; it ensures flexibility and can create a wide range of use cases. The most common use cases of the messaging queue in Kubernetes are:

When messages need to be processed in a coordinated approach, a synchronous pattern would be implemented and used. The multi-stage pipeline approach allows for messages to be processed in a sequence between the different services. The multi-stage pipeline approach handles messages that cannot be processed as well. It does this by adopting a dead letter queue mechanism that accepts an unprocessed message and processes it in a predefined way. In a multi-stage Pipeline system, each service is considered a separate stage, and messages are passed between all the stages in the sequence.

When data needs to be streamed from many data sources such as big data and the Internet of things, it will adopt an A-synchronic pattern. This means big data are processed in a dedicated service such as pipeline, databases, storage, machine learning, and many other approaches. This is an effective mechanism that aggregates many producers to a smaller unit of consumers. With this approach, the delivery of the message is guaranteed.

This is applied when a smaller number of producers need to send a message to a larger number of consumers. A service that behaves like a publisher would send a message to a channel. And the subscribers would receive the message in real-time via the channel. This acts typically like cable TV sending content its many subscribers around the world.

Connectivity solutions such as Application programing interfaces, databases, and storage devices would act as a router to send messages to the consumers. This means they connect with each other and distributes information’s among them to send a unified data to the end-users

Ease of use

Microservices architecture saves time, money, and is super easy to use. It seamlessly unifies operation workflows and development, thereby saving great cost. Ease of use also ensures that the need for dedicated IT experts is not needed. Microservices ensure efficient memory usage, low latency, fundamental patterns, and support for high volume messaging. It doesn’t compromise real-time pub/sub, request/reply, and queue.

Gradual Migration to Kubernetes

Migration to Kubernetes must be done gradually to keep the data ongoing and ensure the business is operational. To achieve this Kubernetes messaging queue must connect seamlessly with the old and new system. Connectivity ensures that migration is carried out in a step by step procedure where new services are created without any downtime.