Lesson 17 of 19 · 20m
etcd, the API Server, and the Day Writes Stop
Every object lives in etcd behind the API server — when the store fills or a list storm lands, the data plane keeps running while the control plane goes read-only.
Kill the control plane on a healthy cluster and almost nothing happens. Pods keep running, Services keep routing, HTTP keeps flowing. What stops is change: no new pods, no endpoint updates, no scaling decisions, no failover. The data plane and control plane are separate systems that share a heartbeat, and production incidents live in the gap — the control plane fails soft, which is why you notice it when someone tries to deploy, not when it broke.
etcd has opinions
Every object — Pod, ConfigMap, Lease — is a key in etcd, a Raft-replicated store fronted by kube-apiserver. etcd wants odd member counts: three or five for quorum; two is strictly worse than one, because a single failure still drops quorum but you've doubled the blast radius. Two limits worth knowing cold:
--quota-backend-bytes— 2 GiB upstream default; clusters with tens of thousands of objects commonly run 8 GiB. Hit it and etcd raises a NOSPACE alarm and goes read-only. Recovery is compact (etcdctl compact), defrag (etcdctl defrag),alarm disarm— in that order.--max-request-bytes— 1.5 MiB default. A single object bigger than that is rejected withetcdserver: request is too large. If you're stuffing schemas into ConfigMaps, that's the wall; etcd's documented ceiling is ~10 MiB, but the right answer is usually "that object shouldn't exist."
etcdctl endpoint status -w table shows DB size, raft index, and leader per member — the first thing to read when writes get weird.
The API server's admission problem
kube-apiserver multiplexes everything: kubectl, kubelets reporting node status, every controller's informer. Before API Priority and Fairness, the defense was --max-requests-inflight and --max-mutating-requests-inflight — crude caps under which a client doing full LISTs of 200k objects could starve node heartbeats. Starved heartbeats mark nodes NotReady; NotReady nodes start evictions. The failure compounds from one bad client.
APF — GA in Kubernetes 1.29 — replaces caps with queues. FlowSchema objects match request shapes into PriorityLevelConfigurations that own concurrency shares. system covers kubelets and kube-system; exempt bypasses queueing entirely; global-default is the floor. The point isn't throughput — it's that a broken controller can no longer take heartbeats down with it.
Watches and the relist storm
Controllers don't poll; they open a watch — a long-lived HTTP stream of change events keyed by resourceVersion. etcd compacts old revisions, and when a watcher's stored revision falls behind the compaction watermark, the API answers 410 Gone, "too old resource version." client-go then does a full LIST and re-watches. One watcher relisting is routine. A thousand controller replicas relisting simultaneously — say, after an apiserver restart — is the relist storm, and it reads exactly like a "slow" control plane while every object in etcd streams through JSON encode. This is why pagination exists (limit=500&continue=...) and why streaming lists (WatchList, beta since 1.32) were built.
Leader election rides the same store: controllers elect via coordination.k8s.io Lease objects — plain Kubernetes objects updated by compare-and-swap — which is why a read-only etcd freezes failover too.
What to actually do
- During an incident, check the control plane first:
kubectl get --raw /livezand/readyzon the apiserver, plusapiserver_request_totalandapiserver_current_inflight_requestsmetrics. - Keep ConfigMaps under ~100 KiB. Something bigger wants a volume or an object store, not etcd.
- Never cron
kubectl get -Aagainst a large cluster — paginate, or use field/label selectors. Every unpaginated list costs apiserver memory times the number of watchers it must serialize for. - Set
--quota-backend-bytesto 8 GiB before you need it; you'll still defrag during alarm recovery, but you won't hit the wall at 2 GiB.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
What is Platform as a Service? The Sweet Spot Between "Too Easy" and "Too Much Work"
Platform as a Service sits between raw servers and fully managed software. You push code, the platform runs it. No Nginx config, no OS patches, no 3 AM server alerts. Here is what PaaS actually gives you, what it costs you in control, and how to decide if it is the right layer for your application.
The World now is Serverless and Container based
A new report from Datadog reveals that serverless computing could be entering the mainstream. This has already been the case in my world for the past few years. Results show that more than half of all organizations are using serverless on one of the three major public cloud providers: Amazon,
PostgreSQL 19 Is Out. REPACK Kept My Writes Running. The Docker Upgrade Will Stop Your App.
PostgreSQL 19 shipped on November 19 with REPACK (CONCURRENTLY), which removes table bloat without blocking writes. I measured it against VACUUM FULL, ran the upgrade from 18, and checked what breaks for self-hosters: Docker tags that refuse to start, a config setting that stops the server, and...
Self-Hosting Prometheus and Grafana: Infrastructure Monitoring That Actually Works
Build a production-grade monitoring stack with Prometheus and Grafana from scratch. Covers architecture, Docker Compose deployment, Node Exporter, alerting with Alertmanager, PromQL from basics to advanced, pre-built dashboards, and everything SudoSecurity uses to monitor its own infrastructure.