In Kubernetes, how do I autoscale based on the size of the queue?

Suppose I have an instance of RabbitMQ and a set of modules that select messages from RabbitMQ and process them. How to get Kubernetes to increase the number of containers while increasing the size of the queue?

(I mention RabbitMQ, but this is just an example. If you want, choose your favorite message queuing software or balancer.)

+5
source share
2 answers

You can write a very simple controller that keeps track of the queue size for your specific application, and then changes the number of replicas required by your replication / set / replica controller.

The built-in auto-swap function of horizontal swap will soon receive support for custom metrics, but before that itโ€™s pretty easy to program / script yourself.

0
source

The top-level solution for this is pretty simple:

Configure a separate container that is connected to your queue and uses the Kubernetes API to scale deployments.

There are already some solutions to this problem, but they, however, do not look like they are actively supported and prepared for production, but can help:

-1
source

All Articles