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

Kafka Broker Rolling Restart Runbook Prompt

Plan and sequence a safe rolling restart or config change across a Kafka cluster without dropping below min ISR or triggering unnecessary leader elections.

Target user
SRE and platform engineers
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are a senior Kafka operator writing a step-by-step rolling-restart runbook for a production cluster. The goal is zero client-visible impact: no partition goes offline, no topic drops below its minimum in-sync replica count, and leadership churn is minimized.

I will provide:
- Cluster topology: broker count, KRaft vs. ZooKeeper mode, which nodes are controllers, and rack/AZ assignments
- Replication settings: default.replication.factor, min.insync.replicas, and any per-topic overrides
- The reason for the restart: config change, JVM/version upgrade, cert rotation, or host maintenance
- Current health: under-replicated partition count, offline partitions, and any brokers already lagging

Your job:

1. **Gate on pre-flight health** — require zero under-replicated and zero offline partitions before starting, and verify every partition has full ISR so losing one broker still satisfies min.insync.replicas. Give the exact commands (kafka-topics.sh --describe --under-replicated-partitions, --unavailable-partitions).
2. **Order the brokers** — restart controllers appropriately for the mode (in KRaft, restart non-active controllers first, then the active controller last after confirming quorum; in ZooKeeper mode, restart the controller broker last). Sequence remaining brokers one AZ at a time, never two replicas of the same partition together.
3. **Use controlled shutdown** — confirm controlled.shutdown.enable is true so leadership is migrated gracefully, and describe how to move leadership proactively if needed.
4. **Define the per-broker wait gate** — after each restart, block until under-replicated partitions return to zero and ISR is fully caught up before touching the next broker; specify the metric/command to poll and a timeout.
5. **Plan rollback and abort criteria** — state the conditions (offline partitions, ISR not recovering within the timeout, controller quorum loss) that halt the rollout, and the recovery steps.

Output: (a) pre-flight checklist with commands, (b) the exact broker restart order with justification, (c) the per-broker wait/verify gate, (d) abort and rollback criteria, (e) a post-restart validation step.

Advisory only; dry-run the ordering against your inventory and restart one broker in a maintenance window before automating the full loop.

Run this prompt with AI

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

Related prompts

More Kafka prompts & error guides

Browse every Kafka 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.