You find out how a Kafka cluster handles a broker failure on the day a broker fails, unless you have already tried it.
The usual way to try it is kafka-producer-perf-test in one terminal, kubectl delete pod in another, and a Grafana board you squint at. That gives you a rough feeling. It's hard to repeat next month, hard to run in CI, and it can't answer the question I care about most: did every record the cluster acknowledged survive?
A perf tool reports throughput and latency. A chaos tool reports that the pod died. Neither one knows which records were acked. So I built Kates, which does the load, the fault and the checking together. (I'm the author. It's free, Apache 2.0.)
The idea
Treat resilience as a test with a pass/fail result. You write down the target first, for example:
- 2,000 records/s of 1 KiB with
acks=all, P99 at or under 100 ms - no acknowledged record lost when one broker or one zone goes down
Then you run the load, inject the failure, and compare what you measured with the target. Every run is stored in PostgreSQL, so you can compare today's cluster with last month's.
How the loss check works
The INTEGRITY test puts a sequence number, a run ID hash and a CRC32 in every record. The producer tracks which sequences the broker acknowledged. Afterwards a consumer reads everything back, and any acknowledged sequence it never saw is lost:
Acknowledged: 1 2 3 4 5 6 7 8
Read back: 1 2 3 . 5 6 . 8
Lost ranges: [4-4], [7-7]
Lost: 2
It also checks ordering within each partition and duplicates. A send that failed and was never acked doesn't count as loss.
What else it does
- Load: load, stress, spike, endurance, volume, capacity and round-trip tests, using real Kafka clients on virtual threads.
- Faults: 13 types (pod kill, network partition, CPU/memory/I/O stress, DNS errors, disk fill, node drain...) through LitmusChaos or directly through the Kubernetes API. Which ones you get depends on the provider.
- Guards: a disruption plan is refused if it would hit more brokers than you allowed or leave no broker untouched. There is a dry run.
- CI:
kates gate --min-grade B exits non-zero below that grade, and scenario files carry their own SLA gates. JUnit XML export and a GitHub Action are included. - Security: an A–F audit of broker configuration, with drift detection against a saved baseline.
The CLI is Go, the API is Quarkus (GraalVM native image), and it installs with signed Helm charts.
Try it
Docker Compose is enough for the load, integrity and audit parts (no Kubernetes, under 1 GB of RAM):
curl -fsSLO https://raw.githubusercontent.com/bmscomp/kates/main/docker-compose.yml
docker compose up -d --wait
docker compose exec kates kates test create --type INTEGRITY --records 50000 --wait
docker compose exec kates kates security audit
docker compose down -v
Fault injection needs Kubernetes. With about 16 GB of RAM, kates deploy builds a three-node Kind cluster with each node in its own zone, plus Strimzi, rack-aware brokers, Litmus, Prometheus and Grafana, so you can rehearse losing a zone on a laptop:
brew install kind kubectl helm bmscomp/tap/kates
kates deploy
What it doesn't do
- Fault injection targets Strimzi-managed brokers. Load tests work against any Kafka cluster the API can reach.
- A
LOAD run is one producer and one consumer. Use STRESS for parallel producers. - With the default Litmus provider, fault start and end times can be off by several seconds.
- The security "pentest" attacks nothing: it reads one broker's configuration and the ACL list.
- Numbers from Kind on a laptop tell you about behavior. They are not capacity figures for production.
- Please start with the lab or a staging cluster.
Links
I'd like to hear from people running Kafka on Kubernetes: how do you test broker or zone loss today, and which failure would you want to rehearse that isn't on this list?