Apache Kafka — Event Streaming from Basics to a Platform Service›Operating Kafka · Cheat sheet & self-check

Operating Kafka · wrap-up

Cheat sheet & self-check

Every command from this section on one page.

13 · Kafka on Kubernetes and managed Kafka

Strimzi resources

KafkaThe cluster: version, listeners, authorization, config, operators
KafkaNodePoolA group of nodes with roles (controller, broker), replicas, storage, resources
KafkaTopicA topic as a Kubernetes resource (Topic Operator)
KafkaUserA client identity, ACLs and quotas (User Operator)
KafkaConnect / KafkaConnectorConnect cluster and connectors
KafkaMirrorMaker2Replication between clusters
KafkaRebalanceCruise Control rebalancing proposal

Everyday commands

kubectl get kafka,kafkanodepool -n kafkaCluster status and pools
kubectl get kafkatopic,kafkauser -n kafkaTopics and users with READY state
kubectl describe kafkatopic orders.events -n kafkaConditions explain why something is not ready
kubectl -n kafka exec platform-dual-role-0 -- bin/kafka-topics.sh --bootstrap-server localhost:9092 --listRun 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 kafkaAsk the operator for a safe rolling restart

14 · Security: TLS, authentication, ACLs and quotas

Client security settings

security.protocol=SSL + ssl.keystore.* + ssl.truststore.*TLS with a client certificate (mTLS)
security.protocol=SASL_SSL + sasl.mechanism=SCRAM-SHA-512Username and password over TLS
security.protocol=SASL_SSL + sasl.mechanism=OAUTHBEAREROAuth/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 --listList ACLs
kafka-acls.sh … --add --allow-principal User:orders-svc --operation Write --operation Describe --topic orders. --resource-pattern-type prefixedLet a service write to its own prefix
kafka-acls.sh … --add --allow-principal User:billing-svc --operation Read --group billing. --resource-pattern-type prefixedLet 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-svcPer-user byte-rate limits
kafka-configs.sh … --describe --entity-type users --entity-name orders-svcShow a user's quotas

15 · Monitoring and troubleshooting

Alerts that matter

OfflinePartitionsCount > 0Partitions with no leader: data unavailable (page)
UnderMinIsrPartitionCount > 0Writes with acks=all are being refused (page)
ActiveControllerCount: sum != 1No (or split) controller (page)
UnderReplicatedPartitions > 0 for 5–10 minOne failure away from trouble
Consumer lag in time > SLOA consumer group is falling behind
Disk used > 75–80% on any brokerBrokers stop when the disk fills
RequestHandlerAvgIdlePercent < 30%Brokers are saturated

Diagnose

kafka-topics.sh --bootstrap-server b:9092 --describe --under-replicated-partitionsWhich partitions are missing replicas
kafka-topics.sh --bootstrap-server b:9092 --describe --unavailable-partitionsPartitions with no leader
kafka-consumer-groups.sh --bootstrap-server b:9092 --describe --group gLag per partition, and which member owns it
kafka-log-dirs.sh --bootstrap-server b:9092 --describe --topic-list tPartition sizes per broker and disk
kafka-metadata-quorum.sh --bootstrap-server b:9092 describe --statusController quorum health
kafka-broker-api-versions.sh --bootstrap-server b:9092Can I reach every broker? What versions?

16 · Capacity, performance and disaster recovery

Sizing formulas

Storage = write MB/s × retention seconds × RF × (1 + headroom)Disk across the cluster
Network in = write MB/s × RFProduce 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=allMaximum producer throughput
kafka-consumer-perf-test.sh --bootstrap-server b:9092 --topic t --messages 1000000Consumer throughput

DR

KafkaMirrorMaker2 (Strimzi) / connect-mirror-maker.shReplicate topics, configs and offsets between clusters
replication.policy.class=IdentityReplicationPolicyKeep topic names (no 'source.' prefix) for active-passive
RPO ≈ replication lag; RTO ≈ time to switch clientsWhat you can promise