A service mesh moves the hard parts of inter-service networking out of your application and into a sidecar proxy that sits next to every workload. The data plane is a fleet of Envoy proxies, one per pod, intercepting all east-west traffic: they do the load balancing, the retries, the circuit breaking, the mutual TLS, and the telemetry. But Envoy ships empty. It knows nothing about your services, your routing rules, or your certificates until something tells it. That something is the control plane, and it is the system we are designing.

The control plane’s job sounds simple: watch the desired state of the mesh (what services exist, what traffic policies the operator wrote, which certificates each workload should present) and push the right configuration to each of the thousands of Envoy sidecars, live, without ever restarting a proxy. The devil is in two words: right and live. Envoy configuration is not a flat blob. It is a graph of objects with hard dependencies - a listener points at a route, a route points at a cluster, a cluster points at a set of endpoints. If you push a route that names an upstream cluster the proxy has not received yet, Envoy has nowhere to send that traffic and returns a transient 503. Do this across a thousand proxies during a rollout and you have a visible, self-inflicted outage that lasts exactly as long as your config propagation is out of order.

So the real design problem is not “how do I send config to a proxy.” It is “how do I deliver a consistent snapshot of a dependency graph to thousands of long-lived streaming connections, in the correct order, so no proxy ever sees a dangling reference, while certificates rotate underneath and operators change policy continuously.” Let me do this the way I would in an interview: requirements, sizing, architecture, then take the genuinely hard parts - xDS delivery and snapshot ordering, mTLS certificate issuance and rotation, and scaling the push fan-out - from the naive version, break them, and evolve.

Functional Requirements (FR)

In scope:

  • Configuration distribution (xDS). Translate high-level intent (service definitions, routing rules, policies) into Envoy’s native configuration - Listeners (LDS), Routes (RDS), Clusters (CDS), Endpoints (EDS), and Secrets (SDS) - and push it to every relevant sidecar over a long-lived stream, with no proxy restart.
  • Service discovery integration. Watch the underlying platform (Kubernetes API, a service registry) for the live set of service endpoints and feed them into the mesh as EDS updates within seconds of a pod coming up or going down.
  • Traffic policy management. Let operators declare routing rules (traffic splits for canaries, header-based routing, retries, timeouts, circuit breakers, fault injection) and compile them into the proxy config, applied consistently across the fleet.
  • Mutual TLS and certificate management. Act as (or front) a certificate authority: issue a short-lived X.509 identity certificate to every workload, deliver it over SDS, and rotate it before expiry without dropping connections or restarting the proxy.
  • Observability configuration. Push the rules that tell each sidecar what telemetry to emit - metrics dimensions, access log format, tracing sampling rate, and which stats to export.
  • Consistent, ordered rollout. Guarantee that a configuration change is applied as an atomic, dependency-ordered snapshot per proxy, so a route never references a cluster the proxy has not yet received.

Explicitly out of scope (state this to control scope):

  • Being the data plane. We do not proxy or terminate application traffic. Envoy does that. We only configure it. If the control plane is down, existing proxies keep running on their last-known config - the mesh does not stop forwarding traffic.
  • North-south / ingress load balancing as a product. We configure ingress and egress gateways (which are just specially-placed Envoys), but designing an L7 API gateway product is a different problem. Here the focus is east-west, service-to-service.
  • The root of trust / HSM. We assume a root CA key exists and is protected (HSM or an external CA like Vault). We design the issuing and rotation layer, not the root key custody.
  • Application-level authorization logic. We enforce mesh-level policy (mTLS required, which identities may call which services). Fine-grained business authorization stays in the app.

The single decision that drives everything: Envoy config is a dependency graph, and the unit of correctness is a consistent snapshot, not an individual resource. Treat each resource type as an independent stream you update whenever convenient and you will ship dangling references and 503s. Treat the whole per-proxy config as a versioned snapshot delivered in dependency order and the transient errors disappear. Most of this design is about making that snapshot abstraction real at scale.

Non-Functional Requirements (NFR)

  • Availability of the mesh: extreme, and decoupled from the control plane. The data plane must keep serving traffic even if the control plane is completely down. Envoy caches its last config and keeps forwarding. The control plane’s own availability target is high (99.9%+) but its outage degrades configurability, not traffic. This decoupling is a core property, not an accident.
  • Config propagation latency: seconds. A policy change or an endpoint change (pod up/down) should reach all affected proxies within roughly 1-5 seconds at p99. Stale endpoints mean routing to dead pods; stale policy means a canary that does not take effect.
  • Zero transient errors during rollout. The headline correctness property: a valid config change must never cause a 503 due to ordering. Snapshots are atomic and dependency-ordered per proxy.
  • Certificate freshness and zero-downtime rotation. Workload certs are short-lived (hours, not years). Rotation happens continuously and must never drop an in-flight connection or require a proxy restart.
  • Scale: ~10,000 Envoy sidecars (one per pod) across ~1,000 services in a cluster, each proxy holding a long-lived bidirectional gRPC stream to the control plane. Endpoint churn of hundreds of changes per second steady-state, spiking to thousands during a deploy or autoscale event.
  • Consistency: config convergence is eventually consistent across the fleet but each individual proxy’s config must always be internally consistent (no dangling references at any instant). Different proxies may briefly be on different snapshot versions; none may ever be on a broken one.
  • Scalability of fan-out: a single popular service changing endpoints can require pushing a delta to thousands of watching proxies at once. Fan-out of changes, not request volume, is the pressure.

Back-of-the-Envelope Estimation (BoE)

Let me ground the numbers, because they drive the architecture toward delta updates and horizontal sharding of the control plane.

Mesh size:

Services                          ~1,000
Pods / sidecars (total)           ~10,000
Avg pods per service              ~10
Open xDS streams                  ~10,000  (one persistent gRPC stream per sidecar)

Ten thousand persistent bidirectional gRPC connections is the first hard number. This is not request-response load; it is 10,000 always-open streams that each must be held, watched, and pushed to. Connection state, not request throughput, is the dominant cost.

Config size per proxy:

Clusters a proxy knows about      depends on visibility scope (see deep dive)
  - naive (whole mesh)            ~1,000 clusters + ~10,000 endpoints
  - scoped (only its deps)        ~20 clusters + ~200 endpoints
Per-proxy full config (naive)     ~a few MB serialized
Per-proxy full config (scoped)    ~tens of KB

The gap between those two lines is the single biggest scaling lever, and it is why config scoping (sidecar visibility) exists. Pushing a few MB of config to 10,000 proxies on every change is tens of GB of fan-out per change event. Pushing tens of KB scoped deltas is a rounding error. We will break the naive version in the deep dive.

Endpoint churn (the real pressure):

Pod lifecycle events              hundreds/sec steady-state
  (deploys, autoscale, crashes, liveness restarts)
Deploy / autoscale burst          thousands of events/sec for tens of seconds
Each endpoint change              -> EDS update to every proxy that routes to
                                     that service (its watchers)

Push fan-out math (why naive broadcast breaks):

A popular service (e.g. "auth")   called by ~hundreds of other services
Watchers on its endpoint set      ~hundreds to thousands of sidecars
One pod of auth cycling           push an EDS delta to all of them, within seconds

If we re-pushed FULL config on every change:
  10,000 proxies * few MB * (hundreds of changes/sec) = tens of GB/sec of config
  -> impossible. Must be: scoped + delta + only to watchers.

Certificate load:

Workload certs                    10,000 (one per sidecar identity)
Cert lifetime                     ~24 hours (short-lived by design)
Rotation rate                     10,000 / 24h  ≈ 0.12 certs/sec average
                                  but bursty - fleet-wide rollout can align expiries
Each rotation                     a CSR signed by the CA + an SDS push to one proxy

Certificate signing is cheap on average (a fraction of a cert per second) but the control plane must avoid synchronized expiry across the fleet, or it gets a thundering herd of CSRs. Jittered lifetimes and early rotation handle that.

Control plane sizing:

Streams per control-plane instance   ~1,000-3,000 (memory + CPU bound by watches)
Instances needed                     ~4-10 (for 10,000 streams + headroom)
-> control plane is horizontally sharded by proxy, stateless per instance,
   each instance watches the same source of truth and serves a subset of proxies.

The key insight from the numbers: the cost is proportional to the number of persistent streams and the fan-out of changes, not to request traffic. So we design for (a) holding tens of thousands of streams cheaply across a horizontally-scaled control plane, (b) sending scoped deltas only to interested proxies, and (c) never re-sending a full config when a small part changed.

High-Level Design (HLD)

The architecture is the classic two-layer mesh: a data plane of Envoy sidecars and a control plane that programs them. Istio is the reference implementation (its control plane is istiod), and the design generalizes to any xDS-speaking mesh.

The control plane has four logical responsibilities, which in a mature system are distinct modules even if they ship in one binary:

  • Config ingestion and abstraction. Watch the sources of truth: the platform’s service registry (Kubernetes endpoints), and the operator’s intent (traffic policy CRDs - VirtualServices, DestinationRules, AuthorizationPolicies). Build an internal, normalized model of the desired mesh state.
  • xDS server. For each connected proxy, compute its scoped config, assemble it into a versioned snapshot, and stream updates over the Aggregated Discovery Service (ADS) - a single gRPC stream carrying all resource types in dependency order.
  • Certificate authority (CA). Receive CSRs from workloads (authenticated by their platform identity, e.g. a Kubernetes service-account token), sign short-lived SVID certificates, and make them available over SDS for rotation.
  • Sidecar injection. A mutating admission webhook that injects the Envoy sidecar container (and an init container to set up iptables redirection) into every pod at creation. One-time setup, off the hot path, so I mention it but do not dwell.
   Operator intent                    Platform service registry
   (VirtualService, DestinationRule,  (Kubernetes Endpoints /
    AuthorizationPolicy - CRDs)        service discovery)
            │                                   │
            ▼                                   ▼
 ┌──────────────────────── CONTROL PLANE (sharded, N instances) ──────────────┐
 │                                                                            │
 │   ┌──────────────┐   watches    ┌───────────────────────────────────────┐ │
 │   │  Config      │◄────────────►│  Internal mesh model (normalized)      │ │
 │   │  Ingestion   │              │  services, routes, policies, endpoints │ │
 │   └──────┬───────┘              └───────────────────────────────────────┘ │
 │          │ pushes model updates                                           │
 │          ▼                                                                 │
 │   ┌──────────────┐   per-proxy   ┌──────────────┐    ┌──────────────┐      │
 │   │  xDS Server  │──snapshot────►│  Snapshot    │    │  Certificate │      │
 │   │  (ADS)       │   builder     │  cache       │    │  Authority   │      │
 │   └──────┬───────┘               └──────────────┘    └──────┬───────┘      │
 │          │ ADS stream (LDS/RDS/CDS/EDS/SDS)                  │ sign CSR     │
 └──────────┼───────────────────────────────────────────────────┼────────────┘
            │  one persistent bidi gRPC stream per sidecar       │ SDS (certs)
            ▼                                                    ▼
 ┌────────────────┐   ┌────────────────┐   ┌────────────────┐  (~10,000 pods)
 │ Pod A          │   │ Pod B          │   │ Pod N          │
 │ ┌──────┐┌─────┐│   │ ┌──────┐┌─────┐│   │ ┌──────┐┌─────┐│
 │ │ app  ││Envoy││   │ │ app  ││Envoy││   │ │ app  ││Envoy││
 │ └──────┘└──┬──┘│   │ └──────┘└──┬──┘│   │ └──────┘└──┬──┘│
 │   iptables │   │   │   iptables │   │   │   iptables │   │
 └────────────┼───┘   └────────────┼───┘   └────────────┼───┘
              └──── east-west mTLS traffic, proxy<->proxy ┘
   (DATA PLANE: proxies forward traffic using LAST-KNOWN config even if
    the control plane is down. Control plane outage != traffic outage.)

Proxy bootstrap flow (one-time, per pod):

  1. A pod is created. The mutating webhook injects the Envoy sidecar and an init container. The init container installs iptables rules that redirect all inbound and outbound TCP through the local Envoy.
  2. Envoy starts with a tiny static bootstrap config that contains exactly one thing it needs to know: the address of the xDS server (the control plane). Everything else is dynamic.
  3. Envoy’s SDS client requests its identity certificate. A node agent in the sidecar generates a key pair, sends a CSR plus its platform identity token to the CA, receives a signed short-lived cert, and hands it to Envoy over the local SDS socket.
  4. Envoy opens the ADS stream to the control plane and asks for its config.

Config distribution flow (the hot path, repeated forever):

  1. Envoy sends a DiscoveryRequest on the ADS stream, declaring the resource types and names it wants (clusters, then the routes/endpoints they reference).
  2. The control plane computes this proxy’s scoped config, builds a consistent snapshot, and streams DiscoveryResponse messages back in dependency order: CDS (clusters) and EDS (endpoints) first, then LDS (listeners) and RDS (routes) that reference them.
  3. Envoy applies each response, warms the new clusters (opens connections, runs health checks), and only then flips its routing to the new config. It ACKs each response with the version it applied; a bad config is NACKed and the proxy keeps running the previous version.
  4. When desired state changes (a pod comes up, an operator edits a policy), ingestion updates the internal model, the snapshot builder recomputes affected proxies’ snapshots, and the xDS server pushes deltas down the already-open streams. No restart, no reconnect.

Certificate rotation flow (continuous):

  1. Each sidecar’s node agent tracks its cert expiry and begins rotation well before it (e.g. at 50% of lifetime).
  2. It generates a fresh CSR, sends it to the CA, gets a new short-lived cert, and pushes it to Envoy over SDS.
  3. Envoy swaps in the new cert for all new connections immediately; existing connections are unaffected. No restart, no dropped traffic. This is why SDS exists instead of mounting certs as files.

Component Deep Dive

Four hard parts, each taken naive-first: (1) xDS delivery and the snapshot ordering problem - the crux of the assignment; (2) consistent snapshot construction and the ADS single-stream requirement; (3) mTLS certificate issuance and zero-downtime rotation; (4) scaling config scope and push fan-out. I break each before fixing it.

1. xDS delivery and the dependency-ordering problem

This is the heart of the assignment: deliver config so a route never references a cluster the proxy has not yet received, avoiding transient 503s during rollouts.

First, the dependency graph. Envoy’s config objects reference each other:

Listener (LDS)  ──routes to──►  Route config (RDS)
                                      │ routes to a
                                      ▼
                                Cluster (CDS)  ──load balances over──►  Endpoints (EDS)
                                      ▲
                                Secret (SDS)  ──provides cert for──►  Cluster / Listener TLS

Dependency rule: a referenced object must exist in the proxy BEFORE the
object that references it is activated. Otherwise -> dangling reference -> 503.

Naive: independent streams per resource type, pushed as they change

Run five discovery services (LDS, RDS, CDS, EDS, SDS), each as its own gRPC stream. When a cluster changes, push CDS. When a route changes, push RDS. Each stream updates whenever its data is ready, independently.

Where it breaks:

  • No ordering guarantee across streams. You add a new upstream cluster reviews-v2 and a route that sends 10% of traffic to it. The RDS stream and the CDS stream are independent. If the RDS update (the route naming reviews-v2) arrives at a proxy before the CDS update (the definition of reviews-v2), Envoy has a route pointing at a cluster it has never heard of. Traffic matching that route gets a 503: “no healthy upstream” / “cluster not found.” This is precisely the transient-error class the assignment calls out.
  • The reverse ordering also bites on removal. Remove a cluster before removing the routes that reference it and you get the same dangling reference in reverse.
  • Multiple TCP streams multiply connection cost. Five streams per proxy times 10,000 proxies is 50,000 streams. More state, more head-of-line coordination problems, and still no cross-stream ordering.
  • Partial-update races. A single logical change (add cluster + its endpoints + a route) spans three streams that update at three different moments, so there is a window where the proxy’s config is internally inconsistent regardless of which order they land in.

The root cause: the unit of change is a single logical snapshot, but independent streams deliver it as uncoordinated fragments. Envoy’s config is a graph; delivering graph nodes without respecting edges produces dangling references.

Better: Aggregated Discovery Service (ADS) - one ordered stream, snapshot-versioned

Collapse all resource types onto a single gRPC stream per proxy (ADS). Because it is one stream, the control plane controls the exact order in which resources reach the proxy, and Envoy applies them in receive order. Now you can enforce the dependency rule with a simple make-before-break sequencing:

ADS push order for "add cluster reviews-v2 and route 10% to it":

  1. CDS  -> send clusters INCLUDING the new reviews-v2   (define it first)
  2. EDS  -> send endpoints for reviews-v2                (populate it)
       Envoy WARMS reviews-v2: opens connections, runs health checks.
       The cluster is now ready to receive traffic.
  3. RDS  -> send the route that references reviews-v2     (reference it last)
       Now, and only now, does traffic start flowing to it.

Removal is the exact reverse (break-after-make):
  1. RDS  -> stop referencing reviews-v1
  2. (traffic drains off v1)
  3. CDS  -> remove cluster reviews-v1

Rule: add in dependency order (depended-on first); remove in reverse.

Two mechanisms make this robust:

  • Cluster warming. When Envoy receives a new or changed cluster via CDS, it does not activate it until it has the corresponding EDS endpoints and has run initial health checks (“warmed” it). Only then is the cluster usable. So even the CDS-then-EDS gap is handled by Envoy itself - a route that lands early would find a cluster that is “known but not yet warm,” and Envoy holds the warming cluster rather than erroring on a totally-unknown name. Sending EDS before RDS makes this airtight.
  • Versioned, nonce-tracked ACK/NACK. Each DiscoveryResponse carries a version and a nonce. Envoy replies with a DiscoveryRequest ACKing the version it successfully applied, or NACKing with an error detail if the config was rejected. The control plane tracks, per proxy, which version it is on. A NACK means the proxy keeps its last good config - a broken push can never take down a proxy, it just fails to advance. This is the safety net under the ordering: even if ordering logic had a bug, a dangling-reference config would be NACKed, not silently 503-ing forever.

Why ADS wins: a single ordered stream turns “coordinate N independent updates” into “emit one correctly-ordered sequence,” which is a problem the control plane can actually solve deterministically. The 503-during-rollout class of bugs is a direct consequence of not using ADS (or not sequencing within it); using it with make-before-break ordering eliminates them.

State-of-the-world vs delta xDS. Classic xDS is “state of the world”: each response for a type carries the full set of resources of that type, and Envoy diffs. This is simple and self-healing (a dropped message is corrected by the next full snapshot) but expensive at scale - every endpoint change re-sends every endpoint. Delta/incremental xDS sends only the resources that changed plus a list of removed names. For a 10,000-endpoint mesh where one pod cycles, delta xDS sends one added and one removed endpoint instead of 10,000. Use delta xDS for EDS especially, where churn is highest. The ordering discipline is identical; only the payload shrinks.

2. Consistent snapshot construction

ADS gives you an ordered stream. You still have to build the thing you stream: a snapshot that is internally consistent for a given proxy at a given version.

Naive: compute config lazily, straight from live source state, on every push

Every time anything changes, for each affected proxy, read the current Kubernetes endpoints, the current policies, and assemble config on the fly, then push.

Where it breaks:

  • You read a moving target. If ingestion is mid-update (half the endpoints of a service have been processed, half not) and you build a snapshot from that, you push an inconsistent view. The sources of truth are themselves changing under you.
  • Redundant recomputation. A single endpoint change touches one service, but naive rebuilds recompute full config for every proxy that references it, from scratch, every time. Under deploy-burst churn (thousands of events/sec) the control plane melts recomputing identical config.
  • No version anchor. Without an explicit snapshot version, you cannot answer “is this proxy on the latest config,” cannot ACK/NACK meaningfully, and cannot reason about convergence.

Better: a snapshot cache with versioned, immutable per-proxy snapshots

Introduce an explicit snapshot abstraction between ingestion and the xDS server:

  • Immutable, versioned snapshots. A snapshot is a complete, self-consistent set of resources (CDS+EDS+LDS+RDS+SDS) for a given scope, stamped with a monotonic version. Once built, it is never mutated; a change produces a new snapshot version. Immutability means a proxy is always streamed a coherent point-in-time view, never a half-updated one.
  • Debounce / batch the input. Ingestion events are coalesced over a short window (e.g. 100ms) before a snapshot rebuild. During a deploy burst of thousands of endpoint changes, this collapses them into a handful of snapshot versions instead of thousands, trading a tiny bit of latency for a massive reduction in recompute and push volume. This is the single most important throughput control on the build side.
  • Incremental build with caching. Keep the computed sub-configs (per-service clusters, per-policy routes) in a cache keyed by their inputs. A change to one service invalidates and rebuilds only that service’s contribution; the rest of a proxy’s snapshot is reused. Recompute is proportional to what changed, not to mesh size.
  • Snapshot cache keyed by config scope, not by individual proxy. Thousands of proxies often share the same scoped config (all pods of the same deployment want identical config). Compute one snapshot per distinct scope and fan it out to all proxies in that scope, rather than computing 10,000 snapshots. This is both a build-cost and a memory win.
Ingestion events ──► [debounce 100ms] ──► rebuild only changed sub-configs
                                               │
                                               ▼
                                     ┌────────────────────┐
                                     │  Snapshot cache     │
                                     │  scopeKey -> {ver,  │
                                     │   CDS,EDS,LDS,RDS}   │  immutable, versioned
                                     └─────────┬──────────┘
                                               │ on new version for a scope
                                               ▼
                             xDS server pushes ordered delta to every
                             proxy subscribed to that scope (ADS streams)

The snapshot cache is what makes “consistent snapshot per proxy” a concrete, cheap object rather than an aspiration. The xDS server’s job reduces to: when a scope’s snapshot version advances, send the dependency-ordered delta to every proxy on that scope, and track their ACKs.

3. mTLS certificate issuance and zero-downtime rotation

Every proxy-to-proxy hop is mutually authenticated TLS. Each workload needs a cryptographic identity (an SVID - a SPIFFE Verifiable Identity Document, essentially an X.509 cert whose SAN encodes the workload’s identity like spiffe://cluster/ns/default/sa/reviews). The control plane is the CA that issues these.

Naive: long-lived certs mounted as files, issued once at pod start

Sign a one-year cert at pod creation, mount it as a Kubernetes secret, and let Envoy read it from disk.

Where it breaks:

  • Long-lived certs are a liability. A one-year cert that leaks is a one-year window of impersonation. Revocation at mesh scale (CRLs, OCSP across 10,000 proxies) is notoriously unreliable. The security model for mesh identity is short-lived certs you rotate constantly, so a leak self-heals in hours and you never need revocation infrastructure.
  • File-mounted certs require a restart to rotate. Envoy reads the cert file at startup. To pick up a new cert you restart the proxy, which drops every in-flight connection on that pod. Rotating 10,000 proxies by restarting them is a rolling outage. Unacceptable.
  • Secret sprawl. 10,000 private keys sitting in the platform’s secret store is a huge attack surface, and the private key crossing the network (CA generates key, ships it to pod) is itself a weakness.

Better: short-lived certs, key never leaves the pod, delivered and rotated over SDS

  • Key generated locally, only the CSR travels. The node agent inside each sidecar generates the private key in the pod and never transmits it. It sends only a Certificate Signing Request plus a proof of identity (the pod’s Kubernetes service-account JWT) to the CA. The CA validates the token against the platform (confirming “this really is the reviews service account in namespace default”), then signs a cert binding that SPIFFE identity. The private key never crosses the wire.
  • Short lifetimes (hours) with early, jittered rotation. Certs live ~24h (tunable down to minutes for high-security meshes). Each agent rotates at ~50% of lifetime, with random jitter, so expiries do not synchronize across the fleet and the CA never faces a thundering herd. Average signing load stays near 0.1/sec even at 10,000 workloads.
  • SDS for hot swap, no restart. The agent pushes the new cert to Envoy over the local SDS (Secret Discovery Service) socket - the same xDS machinery, but for secrets. Envoy swaps the cert in for all new connections immediately; existing connections keep their old cert until they close naturally. Zero dropped connections, zero restart. This is the entire reason certs go through SDS rather than files.
  • Separate CA path from config path. Certificate signing is latency-sensitive and security-critical; keep it as its own service (even if co-located in the control-plane binary) with its own identity validation, its own audit log, and the root key in an HSM or external CA (Vault, cert-manager). The xDS server consumes SDS pushes but is not the key custodian.
Rotation timeline for one workload (24h cert, rotate at 12h):

 t=0h     pod starts: agent generates keypair IN POD, sends CSR + SA-JWT
          CA validates JWT -> signs 24h cert -> agent -> Envoy via SDS
 t=12h    agent proactively rotates (50% + jitter): new CSR, new 24h cert
          Envoy SDS hot-swap: new conns use new cert, old conns unaffected
 t=24h    old cert would expire, but we already rotated at 12h -> never a gap
          -> private key never left the pod; no restart ever occurred

mTLS enforcement policy. Beyond issuing certs, the control plane pushes the policy that requires mTLS. A PeerAuthentication setting of STRICT compiles into Envoy listener config that rejects any non-mTLS inbound connection; PERMISSIVE accepts both (used during migration so you can onboard without breaking plaintext clients). Identity-based authorization (AuthorizationPolicy: “only frontend may call reviews”) compiles into Envoy RBAC filters that check the peer’s SPIFFE identity from its client cert. All of this is just more config in the same ordered snapshot.

4. Scaling config scope and push fan-out

The control plane holds 10,000 persistent streams and must push changes to the right subset fast. Two things break naively: how much config each proxy gets, and how many proxies each change touches.

Naive: every proxy gets the whole mesh config, every change broadcast to all

Give each Envoy the full set of all clusters, all endpoints, all routes for the entire mesh. On any change, recompute and push to everyone.

Where it breaks:

  • Config size explodes per proxy. With the whole mesh, each proxy holds ~1,000 clusters and ~10,000 endpoints - several MB of config it mostly does not need, since a given service only talks to a handful of upstreams. Memory on the sidecar balloons, and Envoy spends CPU processing irrelevant updates.
  • Fan-out explodes. One pod of the auth service cycling triggers an EDS change. If every proxy holds all config, you push to all 10,000 proxies even though most never call auth. Multiply by hundreds of changes/sec and the control plane’s egress and CPU are saturated pushing config to proxies that do not care.
  • A single control-plane instance cannot hold 10,000 streams. Memory and goroutine/thread overhead per watched stream caps a single instance in the low thousands of streams.

Better: config scoping (visibility) + horizontal sharding + watch-based targeting

  • Scope config to each proxy’s actual dependencies (the Sidecar resource). Compute, from the mesh graph, which upstreams each workload actually talks to (declared via a Sidecar egress config, or inferred). Send a proxy only the clusters/endpoints/routes it can reach. This drops per-proxy config from thousands of clusters to ~20, and - crucially - means a change to service X is only pushed to the proxies whose scope includes X. Scoping is simultaneously a per-proxy size win and a fan-out win. It is the highest-leverage optimization in the whole design.
  • Index watchers for targeted push. Maintain, per resource (per service), the set of proxies subscribed to it. When service X’s endpoints change, look up X’s watcher set and push only to them. auth changing touches the hundreds that call auth, not all 10,000. The push becomes O(watchers), not O(fleet).
  • Horizontally shard the control plane; keep instances stateless. Run N control-plane instances behind the proxies’ connection load balancer. Each proxy connects to one instance; each instance holds ~1,000-3,000 streams. Every instance watches the same source of truth (the Kubernetes API / registry) and builds snapshots independently, so there is no cross-instance coordination for config - a proxy gets correct config regardless of which instance it landed on. Scaling streams is “add instances.” The source of truth (the platform API) is the shared backing store; the control plane itself is a stateless, horizontally-scalable cache-and-push layer.
  • Delta xDS + debounced snapshots (from parts 1-2) compound here. Targeted push (who) + delta payload (what, minimal) + debounce (how often) together keep a deploy burst - thousands of endpoint changes across hundreds of services - to a manageable stream of small, scoped deltas instead of a fleet-wide full-config storm.
Change to service "auth" endpoints:

  naive:  push full config to all 10,000 proxies            = catastrophe
  scoped: look up watchers(auth) = {proxies that call auth}  (~hundreds)
          push delta EDS(auth) only to them                  = O(watchers)

Per control-plane instance holds ~1-3k streams; shard horizontally:

   proxies ──LB──►  [CP-1]  [CP-2]  ... [CP-n]   each stateless,
                       └───────┴─────────┘       each watches the same
                              watch              Kubernetes API / registry
                                │
                       ┌────────▼────────┐
                       │  source of truth │  (platform service registry +
                       │  (K8s API etc.)  │   operator CRDs) - the shared store
                       └──────────────────┘

API Design & Data Schema

APIs

The control plane exposes two very different interfaces: the xDS gRPC API (control plane to proxies, the hot path) and the config/CA APIs (operators and workloads to the control plane).

# ---- xDS (ADS) : control plane <-> each Envoy sidecar, one bidi gRPC stream ----
# Envoy opens: rpc StreamAggregatedResources(stream DiscoveryRequest)
#                                          returns (stream DiscoveryResponse)

DiscoveryRequest  (proxy -> control plane):
  {
    node:            { id: "sidecar~10.1.4.2~reviews-7f3a~default",
                       cluster: "reviews", metadata: {...} },
    type_url:        "type.googleapis.com/envoy.config.cluster.v3.Cluster",
    resource_names:  ["outbound|9080||auth.default.svc", ...],  # what it wants
    version_info:    "v884",     # last version it successfully applied
    response_nonce:  "n-5521",   # ties ACK/NACK to a specific response
    error_detail:    null        # present only on NACK, with the rejection reason
  }

DiscoveryResponse (control plane -> proxy):
  {
    type_url:    "...Cluster",
    version_info:"v885",
    nonce:       "n-5522",
    resources:   [ <CDS/EDS/LDS/RDS/SDS protobufs in dependency order> ],
    # delta variant: resources + removed_resource_names for incremental xDS
  }

# ACK:  next DiscoveryRequest with version_info = "v885", no error_detail
# NACK: next DiscoveryRequest with version_info = "v884" (last good) + error_detail
#       -> proxy keeps running the previous good config; bad push never breaks it

# ---- Certificate Authority : workload node-agent -> control plane CA ----
rpc CreateCertificate(CsrRequest) returns (CsrResponse)
  CsrRequest:  { csr: <PEM>, identity_token: <k8s SA JWT>, validity_seconds: 86400 }
  CsrResponse: { cert_chain: [<leaf PEM>, <intermediate PEM>], root: <PEM> }
  # CA validates identity_token against the platform BEFORE signing.

# ---- Operator config (declarative, via the platform API - CRDs) ----
# applied with: kubectl apply -f policy.yaml  (the control plane watches these)
VirtualService        # routing rules, traffic splits, retries, timeouts, faults
DestinationRule       # per-upstream policy: LB algo, circuit breakers, mTLS mode, subsets
AuthorizationPolicy   # identity-based allow/deny (SPIFFE id -> service)
PeerAuthentication    # mTLS mode: STRICT | PERMISSIVE | DISABLE
Sidecar               # egress scope: which upstreams this workload may reach (scoping)
Telemetry             # metrics dimensions, access log format, tracing sample rate

The load-bearing parts: the node.id is how the control plane identifies and scopes a proxy; the version_info + nonce pair is the entire correctness contract for ordered, safe application; error_detail on NACK is what makes a bad config fail safe instead of 503-ing.

Data / storage schema

The control plane is deliberately near-stateless for config - the source of truth is the platform API (Kubernetes etcd via the API server) plus the operator CRDs. The control plane’s own persistent state is minimal; its working state is in-memory caches rebuilt from watches. This is why it scales horizontally and recovers by re-watching.

Source of truth (external - Kubernetes API / etcd, we only watch it):

Services, Endpoints/EndpointSlices   # live service discovery (who is up)
CRDs (VirtualService, DestinationRule, AuthorizationPolicy, Sidecar, ...)
                                     # operator intent, strongly consistent (etcd/Raft)
# The control plane does NOT own this store. It watches it and reacts.

Internal mesh model (in memory, per control-plane instance, rebuilt from watches):

service {
  name           string        # "auth.default.svc"  (key)
  ports          [ {name, port, protocol} ]
  subsets        map<label, [endpoint]>   # for version-based routing (v1/v2)
  endpoints      [ { ip, port, locality:{region,zone}, health, weight } ]
  policy         { lb_algo, circuit_breaker, outlier_detection, mtls_mode, retries }
}
# Index: by name (routing); by endpoint-ip (reverse lookup); by locality (locality LB).

Snapshot cache (in memory, keyed by config scope):

snapshot {
  scope_key      string        # identifies a set of proxies with identical config
  version        int64         # monotonic; the version_info we stream
  clusters       [Cluster]     # CDS
  endpoints      [ClusterLoadAssignment]  # EDS
  listeners      [Listener]    # LDS
  routes         [RouteConfiguration]     # RDS
  secrets_refs   [name]        # SDS references (cert material delivered separately)
}
# Immutable once built. A change -> a new version. Shared by all proxies in scope.

Per-stream state (in memory, per connected proxy):

stream {
  node_id        string
  scope_key      string        # which snapshot scope it is on
  acked_version  per-type      # last version ACKed, per resource type
  pending_nonce  per-type      # outstanding nonce awaiting ACK/NACK
  watched_names  set<string>   # resources this proxy subscribed to (for targeting)
}

CA state (small, persistent):

ca { root_key (HSM-backed, never exported), intermediate_cert, issued_log (audit) }
# Issued certs are NOT stored as a revocation list - short lifetime replaces revocation.
# Only an append-only audit log of issuances is kept.

Store choice: watch a strongly-consistent external store (etcd via the Kubernetes API), keep everything else as in-memory, rebuildable caches - no additional database. Reasons:

  • The source of truth (service endpoints, operator policy) is already in a linearizable, durable store (etcd/Raft behind the Kubernetes API). Duplicating it into a second database would create two sources of truth and a sync problem. We watch, we do not re-store.
  • The control plane’s working set (mesh model, snapshots, stream state) is ephemeral and reconstructable - on restart, re-watch the API and rebuild. Persisting it buys nothing and adds a consistency hazard. This is exactly why the control plane can be stateless and horizontally sharded.
  • The data is small and hot (a few MB of model, all RAM). A disk-oriented DB’s strengths are irrelevant; its presence would add latency to the hot config path.

This is why meshes do not ship their own database: they ride the platform’s strongly-consistent store for truth and keep the control plane a stateless translation-and-push layer.

Bottlenecks & Scaling

Where it breaks first, in order, and the fix for each.

1. Persistent stream count on a single control-plane instance (breaks first). 10,000 always-open gRPC streams cannot live on one process - memory and per-stream watch overhead cap a single instance in the low thousands. Fix: horizontally shard the control plane, stateless per instance, each watching the same platform API and serving a subset of proxies behind a connection load balancer. Scaling streams becomes “add instances.” No cross-instance coordination because the source of truth is shared and external.

2. Push fan-out on a popular service’s churn. One pod of auth cycling would push to all 10,000 proxies under naive broadcast. Fix: config scoping (Sidecar visibility) + watcher indexing. Push only to the proxies whose scope includes the changed service - O(watchers), typically hundreds, not the whole fleet. This is the highest-leverage fix and it shrinks per-proxy config size at the same time.

3. Config recompute storms during deploy/autoscale bursts. Thousands of endpoint changes/sec would have the control plane rebuilding full snapshots continuously. Fix: debounce ingestion (coalesce events over ~100ms) into a handful of snapshot versions, incremental rebuild of only changed sub-configs with a cache, and delta/incremental xDS so each push carries only the changed resources and removed names, not the full state of the world.

4. The dependency-ordering 503s during rollout. A route referencing a not-yet-delivered cluster returns transient 503s. Fix: ADS single ordered stream + make-before-break sequencing (define and warm clusters/endpoints before referencing them in routes; remove references before removing clusters), backed by Envoy cluster warming and versioned ACK/NACK so a mis-ordered or invalid snapshot is NACKed and the proxy keeps its last good config rather than erroring.

5. Certificate thundering herd from synchronized expiry. A fleet-wide rollout can align cert issuance times, so all 10,000 certs expire together and all rotate at once. Fix: jittered lifetimes and early rotation (rotate at ~50% + random jitter) so expiries spread out; the CA sees a smooth ~0.1/sec average instead of a spike. Keep the CA path independently scalable and co-located with validation so signing stays low-latency.

6. Control-plane outage must not become a traffic outage. If the control plane is down, nothing should stop forwarding. Fix: this is a core property, not a patch. Envoy caches its last-known config and keeps proxying. A control-plane outage freezes configurability (no new endpoints, no new policy, no new certs) but not traffic. The only hard deadline is cert expiry, which is why lifetimes are hours (not minutes) - plenty of buffer to recover the control plane before certs lapse.

7. Hot upstream service and locality skew. A heavily-called service can see uneven load, and cross-zone traffic adds latency and cost. Fix: push locality-aware load balancing config (EDS endpoints tagged with region/zone, priority to same-zone endpoints) and outlier detection + circuit breaking so proxies shed load from unhealthy or overloaded upstreams automatically. This is data-plane behavior, but the control plane configures it via DestinationRule.

8. Source-of-truth (platform API) as a shared dependency. Every control-plane instance watches the Kubernetes API; a slow or overloaded API server slows config propagation mesh-wide. Fix: use efficient watch/informer caches (one shared informer per instance, not per-proxy queries), coalesce and rate-limit re-list storms, and tune the API server. For very large meshes, consider a dedicated read-optimized endpoint or an intermediate aggregation layer so 10 control-plane instances do not each hammer the API server independently.

9. NACK loops from a bad config push. A malformed policy could be NACKed by every proxy repeatedly, wasting cycles and leaving the fleet stuck on old config. Fix: validate config at ingestion (admission webhooks reject invalid CRDs before they ever enter the model), and treat a widespread NACK as a signal to halt the rollout and alert rather than retry-loop. The safety is that proxies keep running - a bad push degrades to “no progress,” never to “broken fleet.”

Wrap-Up

The trade-offs that define this design:

  • Snapshot, not resource, is the unit of correctness. Envoy config is a dependency graph; the whole class of transient-503-during-rollout bugs comes from delivering graph nodes without respecting edges. ADS (one ordered stream) plus make-before-break sequencing plus cluster warming plus ACK/NACK make every per-proxy config internally consistent at every instant. This is the central insight.
  • Control plane configures, data plane forwards - and the two are decoupled. A control-plane outage freezes configurability, never traffic. Proxies run on last-known config. This is the property that lets the mesh survive its own brain going offline, bounded only by cert lifetime.
  • Short-lived certs with keys that never leave the pod, rotated over SDS. Security comes from rotation frequency (hours), not from revocation infrastructure; zero-downtime rotation comes from SDS hot-swap, not file-mount restarts. The private key never crosses the wire.
  • Scope and shard, do not broadcast. Per-proxy config is scoped to actual dependencies, pushes are targeted to watchers, and the control plane is stateless and horizontally sharded over a shared external source of truth. Cost scales with streams and change fan-out, so every lever (scoping, watcher indexing, delta xDS, debounce) attacks exactly those two.
  • Stateless over a borrowed strong store. The control plane owns no database; it watches the platform’s linearizable store and keeps everything else as rebuildable in-memory caches. One source of truth, horizontal scale, trivial recovery.

One-line summary: a stateless, horizontally-sharded control plane watches the platform’s service registry and operator policy, compiles them into immutable versioned per-proxy snapshots, and streams them to thousands of Envoy sidecars over a single ordered ADS gRPC stream in make-before-break dependency order (clusters and endpoints before the routes that reference them, backed by cluster warming and ACK/NACK), while a co-located CA issues short-lived SPIFFE certs rotated live over SDS - so policy, discovery, and identity converge across the fleet in seconds, with zero proxy restarts and zero dependency-ordering 503s, and traffic keeps flowing even when the control plane is down.