Please see here
and here
for more info.
The general problem goes like this.
I have 5 nodes, for some reason either mismatched erlang cookies or temporary network partitions because network issues two distinct groups form. I'll call this group A and group B. Group A consist of nodes 0-2 and Group B consist of nodes 3-4. So, in this case, two distinct clusters are formed and all nodes report healthy. This is very misleading and causes a split brain problem.
Where this issue was first found was using the rabbitmq 3.7 K8s helm chart for deployment.
This helm chart by default generates a random erlang.cookie and gives it to all the nodes.
So step #1 was to create a 3 node cluster in K8s using the helm chart. Everything worked fine, very easy to create a rabbit cluster this way.
Step #2 was to scale up my cluster to 5 nodes using helm upgrade but unknown to me at the time, this generated a random new erlang cookie for the two new nodes.
Still, the nodes came up just fine in K8s all 5 reported healthy so I thought everything is good.
That is until I started sending and receiving messages. Messages were getting lost, not delivered and just seemed like they were disappearing. So I logged into rabbit's UI on node 0 and saw only 3 nodes in the cluster even though K8s said 5 healthy.
Then I logged into rabbit's UI on node 4 and there was a cluster of two nodes. WAIT how is this, two different clusters formed under one stateful set in K8s? This seems ridiculous, this should not happen some error should have been reported.
Since then I've been able to re-create this issues by forcing temporary network partition during the formation of a 5 node cluster, isolating 2 nodes away from the other 3 temporarily just during formation of the cluster.
Something is wrong with the way rabbit is doing auto cluster formation that allows for split brain clusters to form in K8s (and even outside K8s, this problem is not unique to K8s, it can happen with any rabbit cluster)
It seems a simple solution to this could be to have a status command in rabbitctl that could take into account cluster membership health or something of that nature.
I'm curious if others have run into this. Also it would be great if this could be fixed and it becomes a non-problem.
I've tried filing bugs on rabbit github pages but they were closed and I was told to come here and start a discussion so here I am.
Thanks.