<p>My application is running as a container on top of <code>kubernetes</code>.<br>
The application consume messages from <code>rabbitmq</code>.  </p>

<p>I can't predict the exact amount of <code>cpu</code> so I don't want to use it as autoscale limit, though I did set the <code>prefetch</code> to something that looks normal.<br>
Is there a way to follow the number of messages in the queue,<br>
and once there are too much to tell <code>k8s</code> to autoscale?<br>
Or maybe set the autoscale to follow message rate?</p>

<p>I wasn't able to find much content on this which didn't involve using an external source such as StackDriver.</p>

<p>I spent several days working through all the issues, and wrote up a demo app with code on how to do it.  I hope it will help someone:</p>

<p><a href="https://ryanbaker.io/2019-10-07-scaling-rabbitmq-on-k8s/" rel="nofollow noreferrer">https://ryanbaker.io/2019-10-07-scaling-rabbitmq-on-k8s/</a></p>
