Operating Kafka · wrap-up
Cheat sheet & self-check
Every command from this section on one page.
Strimzi resources
Kafka | The cluster: version, listeners, authorization, config, operators |
KafkaNodePool | A group of nodes with roles (controller, broker), replicas, storage, resources |
KafkaTopic | A topic as a Kubernetes resource (Topic Operator) |
KafkaUser | A client identity, ACLs and quotas (User Operator) |
KafkaConnect / KafkaConnector | Connect cluster and connectors |
KafkaMirrorMaker2 | Replication between clusters |
KafkaRebalance | Cruise Control rebalancing proposal |
Everyday commands
kubectl get kafka,kafkanodepool -n kafka | Cluster status and pools |
kubectl get kafkatopic,kafkauser -n kafka | Topics and users with READY state |
kubectl describe kafkatopic orders.events -n kafka | Conditions explain why something is not ready |
kubectl -n kafka exec platform-dual-role-0 -- bin/kafka-topics.sh --bootstrap-server localhost:9092 --list | Run CLI tools inside a broker pod (needs a plain listener or a client config) |
kubectl annotate kafka platform strimzi.io/manual-rolling-update=true -n kafka | Ask the operator for a safe rolling restart |
Client security settings
security.protocol=SSL + ssl.keystore.* + ssl.truststore.* | TLS with a client certificate (mTLS) |
security.protocol=SASL_SSL + sasl.mechanism=SCRAM-SHA-512 | Username and password over TLS |
security.protocol=SASL_SSL + sasl.mechanism=OAUTHBEARER | OAuth/OIDC tokens over TLS |
kafka-topics.sh --command-config client.properties … | Use those settings with admin tools |
ACLs
kafka-acls.sh --bootstrap-server b:9093 --command-config admin.properties --list | List ACLs |
kafka-acls.sh … --add --allow-principal User:orders-svc --operation Write --operation Describe --topic orders. --resource-pattern-type prefixed | Let a service write to its own prefix |
kafka-acls.sh … --add --allow-principal User:billing-svc --operation Read --group billing. --resource-pattern-type prefixed | Let a service use its own consumer groups |
Quotas
kafka-configs.sh … --alter --add-config producer_byte_rate=1048576,consumer_byte_rate=2097152 --entity-type users --entity-name orders-svc | Per-user byte-rate limits |
kafka-configs.sh … --describe --entity-type users --entity-name orders-svc | Show a user's quotas |
Alerts that matter
OfflinePartitionsCount > 0 | Partitions with no leader: data unavailable (page) |
UnderMinIsrPartitionCount > 0 | Writes with acks=all are being refused (page) |
ActiveControllerCount: sum != 1 | No (or split) controller (page) |
UnderReplicatedPartitions > 0 for 5–10 min | One failure away from trouble |
Consumer lag in time > SLO | A consumer group is falling behind |
Disk used > 75–80% on any broker | Brokers stop when the disk fills |
RequestHandlerAvgIdlePercent < 30% | Brokers are saturated |
Diagnose
kafka-topics.sh --bootstrap-server b:9092 --describe --under-replicated-partitions | Which partitions are missing replicas |
kafka-topics.sh --bootstrap-server b:9092 --describe --unavailable-partitions | Partitions with no leader |
kafka-consumer-groups.sh --bootstrap-server b:9092 --describe --group g | Lag per partition, and which member owns it |
kafka-log-dirs.sh --bootstrap-server b:9092 --describe --topic-list t | Partition sizes per broker and disk |
kafka-metadata-quorum.sh --bootstrap-server b:9092 describe --status | Controller quorum health |
kafka-broker-api-versions.sh --bootstrap-server b:9092 | Can I reach every broker? What versions? |
Sizing formulas
Storage = write MB/s × retention seconds × RF × (1 + headroom) | Disk across the cluster |
Network in = write MB/s × RF | Produce plus replication into brokers |
Network out = write MB/s × (RF − 1 + consumer groups) | Replication plus consumer fan-out |
Partitions ≥ max(target MB/s ÷ per-partition MB/s, consumers needed) | Partition count for a topic |
Benchmark
kafka-producer-perf-test.sh --topic t --num-records 1000000 --record-size 1000 --throughput -1 --producer-props bootstrap.servers=b:9092 acks=all | Maximum producer throughput |
kafka-consumer-perf-test.sh --bootstrap-server b:9092 --topic t --messages 1000000 | Consumer throughput |
DR
KafkaMirrorMaker2 (Strimzi) / connect-mirror-maker.sh | Replicate topics, configs and offsets between clusters |
replication.policy.class=IdentityReplicationPolicy | Keep topic names (no 'source.' prefix) for active-passive |
RPO ≈ replication lag; RTO ≈ time to switch clients | What you can promise |