AutoScale pod with RabbitMQ

I want to know if there is a way to create a custom-metric based on the number of consumers in a queue of Rabbit(or based in the time that a message stay on the queue).

I have a consumer application that is limited to consume 1000 messages of a Rabbit Queue. After that, it will disconnect from rabbit(but will stay alive). The problem is that when the 1001th message appears in the queue, I’ll need another application(a replica of the first one) to start consuming the queue, until hits its limit.

So I want to know if its possible to configure kubernetes to identify that the specific queue has no consumers(and the, start a new pod).

Just to clarify, custom metrics can be pretty much anything. They require your application (rabbit) to emit metrics where they are picked up by a metrics adapter, and processed by an independent metrics system (Prometheus, StackDriver etc). In that metrics system, you can manipulate and adjust the metric to be what you want to signal back to the HPA to scale your application by.

This might help clear up how it works:

1 Like