Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for RabbitMQ Difficulty: Advanced ClaudeChatGPTCursor

RabbitMQ on Kubernetes Cluster Operator Deployment Design Prompt

Design a production RabbitMQ deployment on Kubernetes using the RabbitMQ Cluster Operator, covering StatefulSet sizing, quorum queues, persistence, anti-affinity, and safe rolling upgrades.

Target user
Platform and SRE engineers running RabbitMQ on Kubernetes
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are a senior platform engineer who has run RabbitMQ on Kubernetes in production using the RabbitMQ Cluster Operator. Help me design a deployment that survives node drains, pod rescheduling, and rolling upgrades without losing messages or splitting the cluster.

I will provide:
- Target throughput and message profile: publish/consume rates, average and max message size, persistence requirement, and how many queues/connections [DESCRIBE]
- The Kubernetes environment: managed or self-hosted, node count and zones, available StorageClasses, and whether pod anti-affinity across zones is possible [DESCRIBE]
- Availability target: acceptable downtime, whether publishers can tolerate brief backpressure, and RPO for durable messages [DESCRIBE]
- Any existing manifests: the RabbitmqCluster CR, StorageClass, and resource requests/limits [PASTE IF ANY]

Your job:

1. **Size the cluster** — recommend an odd `replicas` count (3 or 5, never 2) so quorum queues and the underlying Raft/Mnesia layer keep a majority when one pod is down. Explain why an even count is dangerous under a single node drain, and set CPU/memory requests and limits that leave headroom below the `vm_memory_high_watermark`.

2. **Choose queue types** — default to quorum queues for durability and predictable failover on Kubernetes, and explain when streams or classic queues are appropriate. Call out that classic mirrored queues are deprecated and a poor fit for a rescheduling-heavy environment.

3. **Persistence and identity** — specify a StorageClass with `volumeBindingMode: WaitForFirstConsumer`, per-pod PVCs via the StatefulSet the Operator manages, and why stable network identity (headless service, `rabbitmq-peer-discovery-k8s`) matters for cluster formation and recovery.

4. **Scheduling and resilience** — pod anti-affinity (ideally topology-spread across zones/nodes), a PodDisruptionBudget with `maxUnavailable: 1`, readiness/liveness probes, and `terminationGracePeriodSeconds` long enough for a clean node shutdown so queues migrate leadership before the pod dies.

5. **Upgrades** — how the Operator performs a rolling StatefulSet update (one pod at a time, ordered), why you must wait for each pod to fully rejoin and rebalance quorum leaders before the next, and how feature-flag state and mixed-version windows are handled.

6. **Config and observability** — the `additionalConfig` / `rabbitmq.conf` settings that matter on Kubernetes (partition handling `pause_minority`, watermarks, disk_free_limit relative to the PVC size), plus the Prometheus plugin and the metrics to alarm on.

Output as: (a) a recommended RabbitmqCluster CR with the key fields and rationale inline, (b) the StorageClass and PDB, (c) the upgrade runbook step order, and (d) the alerts and watermarks to set. Flag every place my described constraints force a trade-off.

Prefer quorum queues and `pause_minority` partition handling. Do not recommend a 2-replica cluster or classic mirrored queues for new deployments, and never suggest clearing PVCs as a recovery step without an export-first caveat.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Why this prompt works

Running RabbitMQ on Kubernetes fails in a specific, repeatable way: teams pick an even replica count, use classic mirrored queues out of habit, and then discover during the first node drain that a two-node cluster has no majority and mirrored queues split-brain. This prompt front-loads the decisions that actually determine survivability — an odd node count, quorum queues, and pause_minority partition handling — instead of treating them as tuning done after the fact.

It also forces the Kubernetes-specific details that the RabbitMQ docs alone don’t connect: WaitForFirstConsumer binding so PVCs land near their pods, a PodDisruptionBudget so cluster-autoscaler and node upgrades can’t evict two brokers at once, topology-spread anti-affinity so a single zone loss doesn’t take a majority, and a termination grace period long enough for quorum leadership to migrate before a pod is killed. These are the settings that separate a cluster that shrugs off a node drain from one that drops messages during routine maintenance.

Finally, the prompt encodes the upgrade discipline the Cluster Operator relies on — one pod at a time, fully rejoined and rebalanced before the next, with feature-flag and mixed-version awareness. Combined with the guardrails against 2-node clusters and against clearing PVCs to “reset” a broker, it turns a fragile hand-rolled StatefulSet into a deployment design you can defend in a review and operate through failures.

Related prompts

More RabbitMQ prompts & error guides

Browse every RabbitMQ prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.