Networking
Terminating TLS and mTLS
Where an encrypted connection ends and plaintext begins, the three common placements, and how mutual TLS with short-lived workload identities protects traffic between services.
Encrypted traffic has to be decrypted somewhere, because the application needs plaintext to work. The point where that happens is called termination. Choosing it decides which hops are encrypted, who holds the certificates, and what a load balancer can see. Inside a data center, the same question returns for every service-to-service call.
Concept
Termination: the place where a TLS connection ends and its contents become plaintext. Anything after that point is only as private as the network path beyond it.
The big idea: where the plaintext lives
There are three common placements.
| Placement | Who decrypts | What the load balancer can see | Trade-off |
|---|---|---|---|
| Edge termination | Load balancer or CDN | Full HTTP | Simple, certificates in one place. Traffic inside the network is plaintext. |
| Re-encryption | Load balancer, then a new TLS connection to the backend | Full HTTP | Encrypted on every hop. More work, more certificates. |
| Passthrough | The application | Only the SNI name | Most private. The load balancer cannot read HTTP for routing. |
Edge termination is the usual default. Re-encryption is the common answer when a compliance rule, such as PCI DSS or HIPAA, requires encryption in transit everywhere.
Walking through a request
Here is a request through a load balancer that re-encrypts.
client ──TLS (cert: www.example.com)──► load balancer
decrypts, reads the path, picks a backend
load balancer ──TLS (cert: backend)──► app server
decrypts, runs the handlerEach hop has its own certificate and its own expiry date. Every extra hop adds one more thing to renew. This is why automation matters even more with re-encryption.
Zero trust and mutual TLS
Inside a data center, the older assumption was that the internal network was safe. The newer one, called zero trust, says not to trust the network. Each service encrypts and authenticates every call.
In mutual TLS (mTLS), the client also presents a certificate, so each side proves its identity to the other. A call is then allowed because of who the caller is, not which IP address it came from.
Managing certificates for thousands of short-lived containers by hand is not practical. Two approaches automate it.
- SPIFFE defines a standard workload identity, written as a URI such as
spiffe://prod.example.com/ns/payments/sa/api. The identity is placed in the SAN of a short-lived certificate, often valid for an hour. SPIRE is a reference implementation that issues these certificates after checking what a workload is. - Service meshes, such as Istio and Linkerd, add a proxy beside each workload. The proxy does mTLS and rotates certificates automatically. The application speaks plain HTTP to localhost. Authorization rules can then say "only
payments/apimay callledger" in terms of identity, not IP addresses.
Walking through an authorization rule
A mesh policy is written in terms of identity, so it survives pods being rescheduled to new IP addresses. This sketch shows the meaning of such a rule, not a real mesh configuration file.
allow: spiffe://prod.example.com/ns/payments/sa/api
to: spiffe://prod.example.com/ns/ledger/sa/writer
for: POST /entries
deny: everything elseWhen the payments/api workload moves to a different node, its identity is unchanged, so the rule still applies. An IP-based firewall rule would break.
Common mistakes
- Assuming edge termination encrypts everything. Traffic after the load balancer may be plaintext.
- Adding hops without adding renewal. Each certificate expires on its own schedule.
- Using shared API keys between services. A key that never rotates is a long-lived secret. Short-lived identities are safer.
- Writing firewall rules by IP address for services. Pods change addresses. Identity does not.
Check yourself
- A load balancer must route by URL path. Which placement can it use? Edge termination or re-encryption, because the load balancer must read the HTTP request. Passthrough hides it.
- Why is an identity-based rule better than an IP-based rule for services on Kubernetes? Pods are rescheduled with new IPs, while the identity stays with the workload.
Key takeaways
- Termination is where plaintext begins. Choose edge, re-encryption or passthrough based on what must be encrypted and what the load balancer must read.
- Re-encryption encrypts every hop, at the cost of more certificates to renew.
- mTLS proves each service's identity to the other, in both directions.
- Use short-lived workload identities and a mesh or SPIFFE so certificates rotate automatically.
Further learning
Next, return to the hub, TLS and certificates, for the performance side of the handshake and a hands-on check with openssl.

Related
TLS and certificates
How HTTPS keeps data private and proves the server's identity, how the TLS 1.3 handshake works, and why expired certificates keep causing outages. Start here for TLS.
Certificate expiry and renewal
Why certificates expire on purpose, why expired ones take sites down, and the playbook for automated renewal, independent monitoring and a full inventory. Includes a check you can run in a minute.
Secrets management and encryption
Keeping credentials out of code and data safe at rest and in transit with KMS, Vault and envelope encryption — plus how to catch leaks before they become incidents.
Cryptography for engineers
The few building blocks you need for everyday security decisions, which question each one answers, and where teams go wrong. Start here for the map.