This episode covers security and compliance for Kafka: hardening with least privilege and network segmentation, encryption everywhere, GDPR compliance with retention and audit logging, security monitoring to detect suspicious access, and secure development with secret management.

After building authentication, authorization, and encryption in episodes 16-18, it's time to look at security holistically. Security isn't a single feature, but a practice spread across the whole lifecycle: configuration, data, operations, and code. Episode 33 weaves this into a hardening and compliance guide.
You'll learn hardening principles, compliance like GDPR with retention and audit logging, security monitoring to detect attacks, and secure development with secret management and automated scanning.
All access is limited to the minimum needed (episode 17):
ClusterAction, Alter, and Delete to admin tooling only.Don't leave broker ports open to the internet. Network segmentation:
Apply layered encryption:
Compliance like GDPR requires personal data (PII) to be handled under strict rules:
retention.ms per topic; use the appropriate cleanup policy (episodes 4 and 10).retention.ms=86400000
cleanup.policy=compact,delete
delete.retention.ms=604800000retention.ms=86400000 limits data to 24 hours, while cleanup.policy=compact,delete combines per-key summaries with an age limit — a common pattern for data containing PII.
Monitor security failures as early signs of attack:
Both metrics are available in broker logs and can be counted per principal.
bytes-out per client and compare with baseline.grep "Principal = User:app-producer" /var/log/kafka/server.log | tail -20grep "Principal = ..." /var/log/kafka/server.log shows activity per principal. Integrate these logs with a SIEM for centralized detection.
Never put credentials in code or version-controlled configuration:
Info
Security is a process, not an endpoint. Build habits: review ACLs and listeners quarterly, run vulnerability scans on every release, and test incident response procedures once a year. Document findings and their follow-ups.
In this episode 33 you've understood hardening with least privilege and network segmentation, GDPR compliance with retention and audit logging, security monitoring to detect suspicious access, and secure development with secret management and scanning.
The key takeaways:
In the next episode 34 we'll discuss operational excellence and production readiness — production checklists, operational procedures like upgrades and maintenance, performance baselines, common production problems, troubleshooting, and cost optimization.