Make RabbitMQ durable/persistent queues survive Kubernetes pod restart
How can I prevent this behavior?
By using a StatefulSet
as is intended for the case where Pods have persistent data that is associated with their "identity." The Helm chart is a fine place to start reading, even if you don't end up using it.
I ran into this issue myself and the quickest way I found was to specify an environment variable RABBITMQ_NODENAME = "yourapplicationsqueuename" and making sure I only had 1 replica for my pod.
What helped in our case was to set hostname: <static-host-value>
apiVersion: apps/v1kind: Deploymentspec: replicas: 1 ... template: metadata: labels: app: rabbitmq spec: ... containers: - name: rabbitmq image: rabbitmq:3-management ... hostname: rmq-host