Notes / Networks / 06 Security / 2 Tls

TLS Offload

Terminating TLS at the ingestion frontier instead of in every backend pod — why it's a Layer 1 responsibility, what it costs in defense-in-depth, and how mTLS re-encryption closes the gap.

Appears in: > Telemetry Ingestion Pipeline §3.1 (ingestion frontier responsibilities).

TLS offload (also called TLS termination) means the encrypted connection from the client ends at one specific point in the architecture — the load balancer, gateway, or sidecar — rather than being decrypted inside every backend process that ultimately handles the request.


Why offload at all

TLS isn’t free. Every connection pays for a handshake (asymmetric crypto — expensive) and then per-record symmetric encryption/decryption for the life of the connection. At the fan-in scale this pipeline is designed for — 100K to 10M agents — that cost adds up:

Without offload:                     With offload:
Agent → TLS → App pod                Agent → TLS → Gateway (offload) → plaintext/mTLS → App pod
        (every pod pays               (offload point pays the handshake cost once
         handshake + cipher cost)      per connection; app pods do zero crypto work)

Concentrating TLS termination at the ingestion frontier means:

  • One place to hold certificates and private keys — not distributed across every replica of every backend service. Rotation is a single operational surface, not N surfaces.
  • One place to enforce TLS version/cipher policy — reject weak ciphers or old TLS versions at the edge instead of auditing every service’s TLS config independently.
  • CPU offload from application pods — crypto work is often handled by dedicated, hardware-accelerated termination points (cloud load balancers, or a proxy like Envoy compiled with AES-NI support), freeing application CPU for actual request processing.

Where it sits in the ingestion frontier

flowchart TD
    A["Agent (OTel SDK / Alloy)"] -->|"TLS 1.3\n(mTLS client cert or bearer token)"| GW["Gateway\n(TLS offload point)"]
    GW -->|"plaintext OR re-encrypted mTLS"| AUTH["Auth · Rate-limit\n· Schema validation"]
    AUTH --> KAFKA["Kafka buffer"]

This is listed as one of the ingestion frontier’s core responsibilities in the main design alongside protocol termination and authentication — all three happen at the same hop because they’re all “figure out who this is and whether to trust them” work that should happen exactly once, as early as possible, before anything reaches the durable buffer.

The trade-off: offload vs. defense-in-depth

Terminating TLS at the edge means the hop after the gateway can be plaintext — which is fine inside a tightly controlled network segment, but is a real security regression in a multi-tenant or compliance-sensitive environment where “assume the internal network is hostile” is the operating model (zero-trust).

ModelWhat travels internallyWhen it’s the right call
Terminate, forward plaintextUnencrypted, inside the trust boundarySingle-tenant, tightly network-isolated (e.g. one VPC, no compliance mandate for internal encryption)
Terminate, re-encrypt (mTLS)Re-encrypted between gateway and every downstream hopMulti-tenant SaaS, regulated data, zero-trust network posture — the norm in a service mesh

Re-encryption is exactly what a service mesh sidecar does: the mesh’s Envoy proxies terminate the inbound mTLS connection, and the app talks to its own sidecar in plaintext over localhost — but the sidecar re-establishes mTLS for the outbound hop to the next service’s sidecar. See What is Envoy for how this sidecar pattern works end-to-end. At the multi-tenant scale this pipeline targets, re-encryption to at least the auth/rate-limit layer (not full plaintext) is the safer default.

Passthrough as the third option

There’s a third mode worth naming: TLS passthrough, where the load balancer routes based on SNI (the hostname in the TLS ClientHello, sent unencrypted) without ever decrypting the payload — the actual termination happens further downstream. This trades away the LB’s ability to do L7 routing (path-based, header-based) since it can’t see inside the encrypted payload, but keeps end-to-end encryption intact all the way to the real termination point. Relevant when the compliance requirement is “no intermediate hop may ever see plaintext,” even the load balancer.


Local graph

Full graph →

Linked from 10 notes

Protocol Termination at the Ingestion Frontier

What actually happens where the wire protocol ends — TCP/TLS handoff, HTTP/2 frame demux, gRPC message decode, protobuf deserialization — and why L4 vs L7 termination and connection-lifecycle tuning are the load-bearing decisions here, not the crypto itself.

OSI Layer Model (L1-L7)

What L1 through L7 actually mean, why 'L7 gateway' and 'L4 load balancer' are load-bearing terms in system design interviews, and why this numbering is unrelated to the pipeline's own Layer 1/2/3 architecture labels.

Protocol Inventory

Every protocol referenced across the telemetry ingestion pipeline design, plus a general L7-termination reference table for the broader 'design an API gateway / load balancer' interview question.

HTTP/2 vs HTTP/1.1

Why the ingestion gateway prefers HTTP/2 (multiplexed gRPC) over HTTP/1.1 — connection reuse, binary framing, and header compression at 100K+ agent fan-in.

2 — Security

Securing the exporter-to-Prometheus link with TLS and basic auth — self-signed certs, bcrypt password hashing, tls_server_config, and end-to-end curl verification, plus an honest look at what this setup doesn't cover.

Authentication at the Ingestion Frontier: mTLS, Bearer Tokens, API Keys

How the gateway proves an agent's credential is valid — mTLS handshake validation, JWT bearer token signature checks, and API key lookups — with the revocation-speed vs operational-complexity trade-off between them, and credential rotation at 10M-agent scale.

3 — Service Mesh

Istio, Linkerd, and Envoy as service mesh implementations, and how sidecars and mTLS turn a mesh into a security and traffic-control layer.

Computer Networks

A book-shaped table of contents for computer networking, from first principles to production systems: Ethernet through IP, TCP/UDP/QUIC, DNS, the HTTP ecosystem, security, cloud/Kubernetes networking, performance engineering, observability/debugging, and distributed-systems networking — cross-linking existing kubernetes/sre/system-design/tech notes instead of duplicating them.

3.1 Layer 1: Ingestion Frontier

Layer 1 of the telemetry ingestion pipeline: the ingestion frontier — responsibilities, fan-in at 100K+ agents, protocol negotiation, batching, backpressure, and rate limiting.

System Design

Principal/Staff-level system design reference collection for MAANG interview preparation — observability pipelines, distributed systems, reliability engineering, and beyond.