Securing a Kafka cluster (TLS, SASL, ACLs), the available mechanisms, implementing encryption, security at scale, Kafka Connect and how to scale and troubleshoot it, per-key ordering, fixing consumer lag, exactly-once semantics, and schema evolution with a registry.
Published September 25, 2026
Security and Connect questions check your operational maturity. The scenario questions (lag, ordering, exactly-once, schemas) come up in almost every Kafka interview. Answer them by naming the exact configuration, then the caveat.
Short answer: Defence in layers:
allow.everyone.if.no.acl.found=false.Key points to cover:
Short answer:
| Concern | Mechanism |
|---|---|
| Encryption in transit | SSL/TLS listeners |
| Authentication | mTLS; SASL/PLAIN (only over TLS), SASL/SCRAM, SASL/OAUTHBEARER, SASL/GSSAPI (Kerberos) |
| Authorisation | ACLs through the StandardAuthorizer (KRaft); pluggable authorisers (for example, platform RBAC) |
| Resource protection | Client quotas (produce/fetch bytes, request rate) |
| Metadata security | Secured controller listeners (or ZooKeeper SASL/TLS in older clusters) |
Short answer:
listeners=SSL://… or SASL_SSL://…), with keystore and truststore settings.security.protocol=SSL or SASL_SSL and a truststore.ssl.endpoint.identification.algorithm=https to verify hostnames.security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="orders-svc" password="${ORDERS_SVC_KAFKA_PASSWORD}";
ssl.truststore.location=/etc/kafka/truststore.p12
Key points to cover:
Short answer:
orders.*).Short answer: Kafka Connect is Kafka's integration framework for moving data into Kafka (source connectors: databases through Debezium CDC, files, SaaS APIs) and out of Kafka (sink connectors: Elasticsearch, S3, data warehouses, JDBC), without writing custom producer or consumer code. Connectors are configured through a REST API. The runtime handles scaling, offset tracking, fault tolerance, converters (JSON, Avro, Protobuf) and single message transforms (SMTs).
Learn it in depth → Batch Processing System
Short answer: It saves you from writing and operating fragile, bespoke integration code. You get reusable, battle-tested connectors, exactly-once support for sources that allow it (and many sinks), automatic offset management, distributed scaling, dead-letter queues for bad records, and standardised operations (REST, metrics). A classic use is CDC with Debezium: streaming every database change to Kafka, reliably and in order, to feed search indexes, caches and analytics.
Short answer:
tasks.max), and the tasks are balanced across the workers.tasks.max, up to what the connector supports. For sinks, that's usually the partition count of the input topics. For JDBC sources, it's the number of tables or queries.Short answer:
errors.tolerance=all with a dead-letter queue topic, and log the context.Key points to cover:
GET /connectors/{name}/status, JMX metrics and lag. Alert on FAILED tasks.Short answer:
orderId), so all of a key's messages land in the same partition, where order is preserved.Short answer:
max.poll.records, fetch.min.bytes, fetch.max.wait.ms. Keep max.poll.interval.ms above the batch-processing time, to avoid rebalance loops.Common trap: only "add more consumers". Beyond the partition count, extra consumers sit idle.
Short answer: Kafka's exactly-once covers read → process → write within Kafka:
enable.idempotence=true, plus a transactional.id.sendOffsetsToTransaction).isolation.level=read_committed, so they never see aborted writes.processing.guarantee=exactly_once_v2.producer.initTransactions();
while (true) {
var records = consumer.poll(Duration.ofMillis(200));
producer.beginTransaction();
for (var r : records) producer.send(new ProducerRecord<>("orders.enriched", r.key(), enrich(r.value())));
producer.sendOffsetsToTransaction(currentOffsets(records), consumer.groupMetadata());
producer.commitTransaction(); // outputs and offsets commit atomically
}
Key points to cover:
Short answer:
orders.v2), and dual-publish during the migration.Key points to cover:
Q: What's the difference between SASL/PLAIN and SASL/SCRAM? A: PLAIN sends the password itself (so it must be over TLS), and brokers verify it against a static configuration. SCRAM uses a salted challenge-response. Credentials are stored hashed in Kafka's metadata, and they can be rotated without restarting brokers.
Q: What is Debezium? A: A set of Kafka Connect source connectors that do change data capture. They read the database's transaction log (MySQL binlog, PostgreSQL WAL), and emit every insert, update and delete as an ordered event. It's commonly used to implement the outbox pattern.
Q: What does read_committed do for consumers?
A: It makes consumers skip records from aborted transactions, and not see records from open transactions until they commit. The consumer only reads up to the "last stable offset".
Q: How do you handle a poison message that always fails processing?
A: Retry a few times with backoff, then publish it to a dead-letter topic (Spring Kafka's DeadLetterPublishingRecoverer), with error headers, commit the offset, and alert. Don't block the partition forever.