Kubernetes v1.37: etcd RangeStream Cuts Memory Use on Large List Reads
If you’ve managed a large Kubernetes cluster, you’ve probably experienced that moment when listing all resources—pods, services, configmaps—suddenly spikes memory usage on your API server. That’s about to get easier to handle. Kubernetes v1.37 is bringing etcd RangeStream to beta, a feature that fundamentally changes how the API server retrieves large collections of objects from etcd. Working in tandem with etcd v3.7, RangeStream reduces memory consumption and makes resource usage more predictable, which matters a lot when you’re running thousands of resources across multiple namespaces.
Here’s what’s actually happening under the hood. Traditionally, when you run a command like kubectl get pods --all-namespaces or when a controller needs to list all resources of a type, the API server asks etcd to return everything matching that query. etcd reads the entire result set into memory, serializes it, and sends it all at once over the network. For clusters with tens of thousands of resources, this can mean loading gigabytes of data into memory simultaneously. RangeStream changes this by streaming results incrementally instead. The API server receives results in smaller chunks, processes and streams them to the client piece by piece, rather than buffering the entire response. It’s the difference between pouring an entire bucket of water at once versus using a steady stream—same amount of water, much more manageable flow.
Why does this matter in practice? Consider a real scenario: you’re running a multi-tenant cluster with 50,000 pods spread across hundreds of namespaces. A monitoring system, HPA controller, or even a routine reconciliation loop needs to list everything. Under the old approach, this operation could consume 4-8 GB of temporary memory on your API server. If several of these operations happen concurrently—which they do in busy clusters—you could hit memory limits and trigger pod evictions. With RangeStream, that same operation streams data more efficiently, keeping peak memory usage closer to your baseline. This also improves responsiveness because clients start receiving results immediately rather than waiting for the entire list to be compiled.
To use RangeStream, you’ll need etcd v3.7 or later and can enable it via the ListFromCache feature gate in your kube-apiserver configuration. It’s in beta now, meaning it’s been tested and is considered safe for production, though as with any beta feature, you should test it in a staging environment first. If you’re running a large cluster—anything with more than a few thousand resources—this is worth testing soon. The memory efficiency gains become more pronounced as your cluster grows, and more predictable memory usage translates directly to better stability and fewer surprise evictions.