RabbitMQ cluster on kubernetes with StatefulSets
UPDATE 2018-1-8: Don’t do it this way. Use the k8s support built in to either the official autocluster plugin (for RabbitMQ 3.6.x) or the new built-in peer discovery feature in RabbitMQ 3.7.x+.
UPDATE 2017-3-18: Improved the
postStart command based on further testing and refinement.
Since I couldn’t find a blog post showing how to do this, I told myself I should write one up once I figured it out. So here it is.
Kubernetes has a relatively new feature called StatefulSets that is designed to make it easier to run containerized services that are inherently stateful. And RabbitMQ is nothing if not inherently stateful. RabbitMQ clusters double down on the whole statefulness thing. After a few years of experience trying to force RabbitMQ clusters into stateless container infrastructure, I was curious to try embracing the statefulness instead. Paint with the grain and all that.
Continue reading →