Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Kubernetes Blog 3 min read Release mediumAdept

Kubernetes v1.37: etcd RangeStream Cuts Memory Use on Large List Reads

Kubernetes v1.37 promotes etcd RangeStream to beta and enables it by default via the EtcdRangeStream feature gate. When paired with etcd v3.7, the API server reads whole collections, such as during watch cache initialization and uncached list fallbacks, through a streaming RPC instead of key-count-paginated Range calls. Previously a full page sat in memory on both etcd and the API server at once. With RangeStream, chunks are sized adaptively by bytes and are decoded and freed one at a time, which lowers peak memory and OOM risk. The API server falls back to paginated Range automatically on older etcd, and a non-zero etcd_request_duration_seconds_count{operation="listStream"} metric confirms the streaming path is in use.

Related posts

  • Announcing etcd v3.7.0

    Kubernetes Blog hardMaster

    etcd v3.7.0 adds RangeStream, an RPC that returns large range results in chunks so neither server nor client has to buffer the whole response. It will reach Kubernetes v1.37 behind the EtcdRangeStream feature gate. Other performance changes include keys-only ranges served straight from the in-memory index without reading bbolt, prioritized LeaseRevoke and a FastLeaseKeepAlive that skips waiting for the applied index, and faster interval-tree find() for watches. The server now bootstraps entirely from v3store, the gogo and golang protobuf libraries are replaced with google.golang.org/protobuf, and experimental flags and legacy v2 packages are removed, so operators should do rolling upgrades and Go module consumers may need code changes.

  • Kubernetes v1.36: Server-Side Sharded List and Watch

    Kubernetes Blog hardMaster

    Kubernetes v1.36 adds alpha server-side sharded list and watch (KEP-5866), letting the API server filter list responses and watch events so each horizontally scaled controller replica receives only its slice of a resource collection instead of deserializing and discarding the full stream. Clients set a new `shardSelector` in ListOptions using `shardRange()` over `object.metadata.uid` or `object.metadata.namespace`. The server matches objects by a deterministic 64-bit FNV-1a hash within `[start, end)`, so results are consistent across API server replicas, and `||` lets one replica cover non-contiguous ranges. Controllers inject the selector through informer `WithTweakListOptions`. They should check for `shardInfo` in the response metadata and fall back to client-side filtering when the server did not honor the selector.

  • How We Found 7 TiB of Memory Just Sitting Around

    Render mediumAdept

    Render's Kubernetes clusters have an unusually large number of namespaces, and daemonsets that listwatch them, such as Vector's kubernetes_logs source, used gigabytes of memory per node and put load on the apiserver during rollouts. Render added an opt-in config option to Vector (insert_namespace_fields) that disables namespace watching, since its config only used namespace labels to identify user pods. A missed second kubernetes_logs source initially hid part of the savings. Per-pod memory fell from nearly 4 GiB to tens of MiB, which freed about 1 TiB on the largest cluster and just over 7 TiB across the fleet.

  • How the controller-runtime Cache Actually Works, and Why Your Controller Does Not Crash the API Server

    Kubernetes Blog hardMaster

    In controller-runtime, r.Get() and r.List() inside a reconciler read from a local in-memory cache built on client-go informers. That cache is filled by a list + watch (now a streaming list with sendInitialEvents) and kept current by the Reflector using resourceVersion, with relists only after 410 Gone. Since client-go 1.36 the delta queue is RealFIFO, which delivers every delta in global order with no deduplication; coalescing of bursts happens only in the controller's workqueue, keyed by namespace/name. The design makes reads nearly free, but it brings stale reads after writes, memory growth from cached objects and indexes, and hidden O(n) List scans, and occasionally a need for APIReader.

  • Interning at incident.io: rate limiting, resiliently

    incident.io mediumAdept

    incident.io made its rate limiter keep working when its Valkey backing store (Google Cloud Memorystore) is unavailable, instead of failing open. Each pod tracks the top-k busiest traffic gates in local memory and keeps an in-memory budget buffer for them, so it can grant up to its local budget and then deny. A simulation benchmark chose HeavyKeeper over Space-saving because Space-saving lost precision under high-cardinality traffic. The change was validated by killing a local Valkey cluster mid-test and was rolled out gradually by gate risk; a follow-up used a Kubernetes informer to divide the limit by the live pod count so the effective limit didn't become limit × pods. The post is framed as an intern's experience and recruiting pitch.

The quest for software engineering knowledge.

Look:
Layout: