Running one Kafka cluster is a lesson; offering Kafka to a dozen teams is a platform. This capstone builds that platform on Kubernetes with Strimzi: size it from the peak, declare the cluster, topics, and users as code, add a schema registry with checks in CI, set client defaults, wire up metrics and lag alerts, and prove it with load and failure drills before anyone depends on it. Two things go wrong on purpose along the way: a topic sized for today, which the load test catches, and a team that lowers min.insync.replicas to 1, which the topic audit catches.
Difficulty: Master · Know this first: Lesson 147, Lesson 148, Lesson 158
This bar splits the platform project, in working days. It is a worked example, not a measurement. Requirements and sizing are three days; getting them wrong is what the drills find.
Six brokers, replication factor 3, and about 10 MB/s per partition. Set the peak, the growth you plan for, the consumers one group will need, and the retention.
partitions = max(peak × growth / 10 MB/s, consumers), disk per broker = 40% of peak × growth × retention × 3 / 6 × 1.3
Too much per broker: add brokers or shorten retention
Three questions. No score is saved anywhere — this is just you against the material.
The capstone grows in four levels: first a working cluster, then a platform others can use, then one proven under load and failure, and finally one that runs for years.
At the basic level you have a Strimzi cluster in Git: KRaft controllers and brokers as node pools, TLS listeners, rack awareness, and topics as KafkaTopic resources. You can explain the sizing: storage from average rate, retention, and replication; partitions from throughput and consumers.
Deliverables: the manifests, a sizing sheet, and one producer and consumer exchanging records over TLS.
Try it: Basic
Why set rack awareness on the zone label?
Now do it: Run kafka_platform.py and change retention to 14 days. How much disk does each broker need?
At the intermediate level teams self-serve.
KafkaTopic and KafkaUser, with ACLs and quotas.Try it: Intermediate
One producer floods the cluster during a batch import and slows everyone. What prevents it?
Now do it: Add a producerByteRate quota to the KafkaUser in Go deeper and explain the number you chose.
At the advanced level the platform has evidence.
KafkaRebalance after adding brokers.Try it: Advanced
During a rolling restart, one broker is already down for disk replacement. Is it safe to restart another?
Now do it: Write the drill plan for a zone loss: what you expect each SLO and alert to do.
At the master level the platform is a product.
Trade-off: a shared platform needs a team and rules teams sometimes resent; separate clusters per team avoid the rules and multiply the operating work and the cost.
Try it: Master
Which topics need cross-region replication?
Now do it: Classify the four launch topics by the recovery they need.
The project's arithmetic and its audit fit in one script: sizing from the peak, partitions for growth, what adding partitions later does to keys, and the topic rules. The hash stands in for Kafka's own (murmur2); the share of keys that move is the same idea. Standard library only; python3 kafka_platform.py.
# kafka_platform.py - size a Strimzi Kafka cluster, audit the topics, and see what adding partitions costs
import math, zlib
# 1. Sizing from the peak, not the average
peak_mb_s, retention_days, rf, brokers, consumer_groups = 60, 7, 3, 6, 4
avg_mb_s = peak_mb_s * 0.4 # the daily average is 40% of the peak here
stored_tb = avg_mb_s * 86_400 * retention_days * rf / 1e6 # MB -> TB
per_broker_tb = stored_tb / brokers * 1.3 # 30% headroom for growth and rebalancing
egress_mb_s = peak_mb_s * (rf - 1) + peak_mb_s * consumer_groups # replication plus every consumer group
print(f"storage {stored_tb:.1f} TB across the cluster -> {per_broker_tb:.1f} TB per broker with headroom")
print(f"network out at peak: {egress_mb_s} MB/s for the cluster, {egress_mb_s / brokers:.0f} MB/s per broker")
# 2. Partitions: enough for the peak throughput and for the consumers you will need later
def partitions(peak_mb_s, per_partition_mb_s, consumers_needed):
return max(math.ceil(peak_mb_s / per_partition_mb_s), consumers_needed)
today, in_a_year = partitions(peak_mb_s, 10, 6), partitions(peak_mb_s * 3, 10, 18)
print(f"orders topic: {today} partitions fit today; {in_a_year} fit 3x growth and 18 consumers")
# 3. Adding partitions later moves keys, so per-key ordering breaks during the change
keys = [f"customer-{i}" for i in range(10_000)]
for new in (12, 18):
moved = sum(zlib.crc32(k.encode()) % 6 != zlib.crc32(k.encode()) % new for k in keys)
print(f"6 -> {new} partitions: {moved / len(keys):.0%} of keys move to a different partition")
# 4. Audit the topics against the platform's rules
topics = [("orders", 3, 2, 18, 6), ("payments", 3, 1, 12, 4), ("clicks", 2, 1, 6, 12), ("audit", 3, 2, 6, 2)]
for name, t_rf, min_isr, parts, consumers in topics: # name, replicas, min.insync.replicas, partitions, consumers
issues = []
if t_rf < 3: issues.append(f"replication {t_rf} < 3")
if min_isr < 2: issues.append(f"min.insync.replicas {min_isr}: acks=all can be acknowledged by one copy")
if parts < consumers: issues.append(f"{consumers} consumers but {parts} partitions: {consumers - parts} sit idle")
print(f"{name:<9} {'ok' if not issues else '; '.join(issues)}")
$ python3 kafka_platform.py storage 43.5 TB across the cluster -> 9.4 TB per broker with headroom network out at peak: 360 MB/s for the cluster, 60 MB/s per broker orders topic: 6 partitions fit today; 18 fit 3x growth and 18 consumers 6 -> 12 partitions: 50% of keys move to a different partition 6 -> 18 partitions: 66% of keys move to a different partition orders ok payments min.insync.replicas 1: acks=all can be acknowledged by one copy clicks replication 2 < 3; min.insync.replicas 1: acks=all can be acknowledged by one copy; 12 consumers but 6 partitions: 6 sit idle audit ok
Read it like this: six brokers need about 9.4 TB each. Six partitions are enough today and 18 are needed for 3x; going from 6 to 18 later moves two thirds of the keys. The audit flags payments and clicks for min.insync.replicas, clicks for replication, and clicks for idle consumers.
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: orders
labels:
strimzi.io/cluster: events
spec:
partitions: 18
replicas: 3
config:
min.insync.replicas: 2
retention.ms: 604800000
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
name: checkout
labels:
strimzi.io/cluster: events
spec:
authentication:
type: tls
authorization:
type: simple
acls:
- resource:
type: topic
name: orders
operations: [Write, Describe]
quotas:
producerByteRate: 10485760
Both parse as YAML. The strimzi.io/cluster label tells the Topic and User Operators which cluster owns them; the quota is 10 MiB/s. Recent Strimzi releases also serve a v1 API; use the version your operator documents.
This is a composite of a failure pattern that keeps repeating; the details are illustrative. A team launched an events topic with 8 partitions, sized for launch traffic, on a shared cluster with no topic rules.
Topics became pull requests with an audit: replication 3, min.insync.replicas 2, partitions sized for a year of growth, and a named owner. Every new platform service now passes a 3x load test and failure drills before launch.
Build a Kafka platform on Kubernetes with Strimzi for 12 teams: launch with 4 topics, grow to 60 within a year.
What peak, growth, and retention per topic? How many brokers and partitions? Which zones? Which rules does the topic audit enforce, and how are exceptions handled? Which schema format and modes? Which client defaults? Which drills, and what passes? Which topics need another region?
Say 60 MB/s at peak today, tripling within a year, 7-day retention, 4 consumer groups per topic, and three zones.
Strimzi with KRaft node pools across three zones and rack awareness; Cruise Control; topics and users as pull requests with ACLs and quotas; a CI audit; a highly available schema registry with CI checks; client templates; Prometheus metrics, lag from Kafka Exporter or KMinion, SLO alerts with runbooks; load and failure drills; monthly capacity reviews; MirrorMaker 2 for the topics that need another region.
A shared platform needs rules and a team to run it; per-team clusters are simpler for each team and costlier overall. Sizing for growth costs disk and brokers now; sizing for today costs a migration later. Strict durability rules occasionally block a team; the exception process must be fast enough that teams do not route around it.