Kafka Encryption: Transit, Rest, End-to-End

Kafka encryption has three layers: TLS in transit, disk encryption at rest, end-to-end for payload protection. Match each to your threat model.

Stéphane DerosiauxStéphane Derosiaux · November 25, 2025 ·
Kafka Encryption: Transit, Rest, End-to-End

Enabling TLS doesn't solve all encryption requirements.

When asked "is your Kafka encrypted?" most teams answer "yes, we use TLS." But encryption has layers, each protecting against different threats. TLS encrypts data in transit (protects against network sniffing), disk encryption protects data at rest (protects against stolen disks), and end-to-end encryption protects message payloads (protects against broker compromise or cloud provider access).

The encryption requirement depends on threat model. If the concern is network eavesdropping, TLS suffices. If the concern is cloud provider employees accessing data, end-to-end encryption is needed. If the concern is stolen hardware, disk encryption matters. Most compliance frameworks require multiple layers.

Real encryption strategy answers: What threats are we protecting against? Who shouldn't be able to read data? What are the operational costs of each encryption layer? The answer isn't "encrypt everything maximally"—it's "encrypt appropriately for the threat model while maintaining operational feasibility."

Encryption in Transit: TLS

Encryption in transit protects data moving between clients and brokers. TLS (Transport Layer Security) encrypts network connections, preventing attackers from reading messages by sniffing network traffic.

What it protects against: Network-level eavesdropping. If an attacker captures packets between producer and broker (through network tap, compromised switch, or man-in-the-middle attack), encrypted traffic is unreadable without keys.

What it doesn't protect against: Broker compromise (brokers decrypt traffic to process it), cloud provider access (cloud admins can access running broker memory), or stolen disks (data at rest isn't encrypted by TLS).

Configuration: Set listeners=SSL://... or SASL_SSL://... on brokers. Clients configure security.protocol=SSL or SASL_SSL. TLS certificates must be valid, trusted, and not expired.

Best practice: Use TLS 1.2 or 1.3 (see encryption configuration tutorial). Disable older versions (TLS 1.0, 1.1, SSL 3.0) which have known vulnerabilities. Configure strong cipher suites, avoiding weak ciphers like RC4 or DES.

Performance impact: TLS adds CPU overhead for encryption/decryption. Modern CPUs with AES-NI instructions minimize this (typically under 5% throughput reduction). Network latency increases by 1-2ms for TLS handshake.

Certificate management: TLS requires certificates for brokers (and optionally clients for mutual TLS). Certificates expire and must be rotated. Tools like cert-manager automate rotation. Manual rotation risks outages when certificates expire unexpectedly.

Mutual TLS (mTLS) extends TLS to authenticate clients through certificates. Both broker and client present certificates, verifying each other's identity. This prevents unauthorized clients from connecting even if they know the broker address.

Use mTLS for: zero-trust environments, high-security scenarios (financial services, healthcare), or when integrating with service meshes that provide mTLS by default.

Encryption at Rest: Disk-Level Protection

Encryption at rest protects data stored on broker disks. If disks are stolen, decommissioned without wiping, or accessed through physical breach, encrypted disks render data unreadable without keys.

What it protects against: Physical media theft, decommissioned hardware sold or discarded with data still present, unauthorized physical access to data center.

What it doesn't protect against: Broker compromise (running broker has disk encryption keys in memory), cloud provider access (cloud admins can access mounted encrypted volumes), or network-level attacks.

Implementation: Cloud providers offer transparent disk encryption (AWS EBS encryption, Azure disk encryption, GCP persistent disk encryption). Enable it at volume creation; Kafka sees normal disks but underlying storage encrypts/decrypts transparently.

For on-premises: LUKS (Linux Unified Key Setup) provides disk-level encryption. Performance impact depends on CPU (AES-NI reduces overhead to under 10%).

Key management: Encryption keys must be protected. Cloud providers integrate with key management services (AWS KMS, Azure Key Vault, GCP KMS). Keys rotate automatically, and access is logged.

For on-premises: Key management systems (HashiCorp Vault, KMIP-compliant systems) store keys securely. Poor key management (keys stored in plaintext config files) defeats encryption entirely.

Performance impact: Modern disk encryption with hardware acceleration (AES-NI) has minimal throughput impact (under 10%). Without hardware acceleration, impact can reach 20-30%.

Compliance implications: Many frameworks require encryption at rest (PCI-DSS for cardholder data, HIPAA for PHI). Disk encryption satisfies this requirement, proving data can't be accessed from stolen or decommissioned disks.

End-to-End Encryption: Payload-Level Protection

End-to-end encryption encrypts message payloads before sending to Kafka and decrypts after consuming. Kafka brokers store and forward encrypted bytes without decrypting them.

What it protects against: Broker compromise (even if an attacker accesses broker storage or memory, message contents are encrypted), cloud provider access (cloud admins can't read messages), unauthorized internal access (platform teams can't read message contents).

What it doesn't protect against: Key compromise (if encryption keys are stolen, messages are decryptable), producer/consumer compromise (keys exist in producer/consumer memory during processing).

Implementation: Application-level encryption at producer, decryption at consumer. Field-level encryption (see also data masking) takes this further by encrypting specific fields rather than entire payloads. Libraries like Tink, AWS Encryption SDK, or custom implementations handle encryption/decryption transparently.

Producer flow:

  1. Application generates message
  2. Encryption library encrypts message payload with data encryption key (DEK)
  3. Encrypted payload sent to Kafka
  4. Kafka stores encrypted bytes without decrypting

Consumer flow:

  1. Consumer reads encrypted bytes from Kafka
  2. Encryption library decrypts payload with DEK
  3. Application processes plaintext message

Key management complexity: End-to-end encryption requires managing encryption keys securely. Options include:

Symmetric encryption: Same key encrypts and decrypts. Fast but requires secure key distribution to all consumers. If key is compromised, all historical data is exposed.

Asymmetric encryption: Public key encrypts, private key decrypts. Producers use public keys (safe to distribute), consumers need private keys (must be protected). Slower than symmetric but better key distribution model.

Envelope encryption: Data encrypted with DEK (symmetric key), DEK encrypted with KEK (key encryption key from KMS). This combines symmetric encryption speed with centralized key management.

Performance impact: Encryption/decryption adds CPU overhead at producer and consumer. Impact varies by payload size: small messages (1KB) see 20-30% throughput reduction, large messages (100KB+) see under 10% reduction because encryption cost amortizes over message size.

Operational complexity: End-to-end encryption adds:

  • Key rotation procedures (how often, how to handle old keys for historical data)
  • Consumer access management (which consumers get decryption keys)
  • Debugging difficulty (can't inspect message contents in Kafka without decryption)
  • Schema evolution (encrypted payloads are opaque to Schema Registry unless schemas are stored separately)

Compliance Framework Requirements

Different frameworks mandate different encryption layers.

GDPR requires appropriate security measures for personal data. TLS satisfies encryption in transit. Disk encryption satisfies encryption at rest. For high-sensitivity personal data (health records, financial data), end-to-end encryption may be required.

PCI-DSS requires encryption of cardholder data in transit and at rest. TLS satisfies transit requirement. Disk encryption or end-to-end encryption satisfies rest requirement. End-to-end encryption is safer because it protects against broader threat model.

HIPAA requires encryption of PHI (protected health information) in transit and at rest. TLS and disk encryption are typical implementation. For high-sensitivity scenarios, end-to-end encryption provides defense in depth.

DORA requires operational resilience, including data protection. Encryption contributes to resilience by limiting data exposure during incidents (broker compromise doesn't expose data if end-to-end encrypted).

When Each Encryption Layer Is Needed

TLS (encryption in transit) is baseline for production deployments. Use always. Exception: development environments on isolated networks might skip TLS for simplicity, but never in production.

Disk encryption is required when: physical security is a concern (on-premises data centers), cloud provider security is insufficient (compliance requires data protection from cloud admins), or regulations explicitly mandate encryption at rest (PCI-DSS, HIPAA).

End-to-end encryption is needed when: message contents must be protected from all intermediaries (including Kafka brokers and platform teams), regulatory requirements demand data encryption beyond transit/rest (financial services, healthcare), or data sensitivity justifies operational complexity.

Not every workload needs all three layers. Event logs (application logs, metrics) might only need TLS. Financial transactions might need TLS + disk encryption. Healthcare records might need all three layers.

Key Rotation and Management

Encryption is only as strong as key management. Weak key management defeats strong encryption.

TLS certificate rotation: Certificates expire (typically 1-2 years for CA-signed certs, 90 days for Let's Encrypt). Automated rotation (cert-manager, ACME protocol) prevents expiration outages. Manual rotation requires calendar reminders and runbooks.

Alert 30 days before certificate expiration. Test rotation procedure in non-production environments. Have rollback plan if rotation fails.

Disk encryption key rotation: Cloud providers handle this transparently (keys rotate automatically without downtime). On-premises LUKS rotation requires re-encrypting disks (downtime or rolling restart).

End-to-end encryption key rotation: Most complex because historical data is encrypted with old keys. Options:

Keep old keys forever: Simple but increases key management burden and expands attack surface (one compromised old key exposes all data encrypted with it).

Re-encrypt on rotation: Decrypt historical data with old key, re-encrypt with new key. Expensive for large volumes but limits exposure window.

Key versioning: Messages include key version in metadata. Consumers look up correct key for each message. This allows rotation without re-encrypting historical data but requires permanent key storage.

Measuring Encryption Coverage

Track encryption adoption across clusters: percentage of traffic using TLS, percentage of brokers with disk encryption, percentage of sensitive topics using end-to-end encryption.

TLS coverage: Should be 100% for production clusters. Any non-TLS listener is a security gap.

Disk encryption coverage: Should be 100% for clusters handling regulated data (PII, PHI, cardholder data).

End-to-end encryption coverage: Depends on data classification. Sensitive topics (containing PII, financial data, health records) should use end-to-end encryption. Non-sensitive topics (application metrics, logs) might not justify the operational cost.

The Path Forward

Kafka encryption isn't one decision—it's a layered approach matching threat model. TLS protects transit, disk encryption protects rest, end-to-end encryption protects payloads. Most deployments need TLS (always) and disk encryption (for regulated data). End-to-end encryption adds complexity but satisfies strictest requirements.

Conduktor validates TLS configuration across clusters, monitors certificate expiration, and enforces encryption requirements through policies. Teams ensure encryption standards are met without manual audits.

If your encryption strategy is "we enabled TLS" without understanding what it protects (and what it doesn't), the problem isn't Kafka—it's threat modeling.


Related: Field-Level Encryption → · Stop Building Encryption Libraries → · Crypto Shredding for GDPR →