<p>Our application uses RabbitMQ with only a single node. It is run in a single Kubernetes pod.</p>

<p>We use durable/persistent queues, but any time that our cloud instance is brought down and back up, and the RabbitMQ pod is restarted, our existing durable/persistent queues are gone.</p>

<p>At first, I though that it was an issue with the volume that the queues were stored on not being persistent, but that turned out not to be the case. </p>

<p>It appears that the queue data is stored in <code>/var/lib/rabbitmq/mnesia/&lt;user@hostname&gt;</code>. Since the pod's hostname changes each time, it creates a new set of data for the new hostname and loses access to the previously persisted queue. I have many  sets of files built up in the mnesia folder, all from previous restarts.</p>

<p>How can I prevent this behavior?</p>

<p>The closest answer that I could find is in <a href="https://stackoverflow.com/questions/46892531/messages-dont-survive-pod-restarts-in-rabbitmq-autocluster-kubernetes-installat">this question</a>, but if I'm reading it correctly, this would only work if you have multiple nodes in a cluster simultaneously, sharing queue data. I'm not sure it would work with a single node. Or would it?</p>

<p>What helped in our case was to set <code>hostname: &lt;static-host-value&gt;</code></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
spec:
  replicas: 1
  ...
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      ...
      containers:
      - name: rabbitmq
        image: rabbitmq:3-management
        ...
      hostname: rmq-host      
</code></pre>
