---
title: "How the controller-runtime Cache Actually Works, and Why Your Controller Does Not Crash the API Server"
description: "In controller-runtime, r.Get() and r.List() inside a reconciler read from a local in-memory cache built on client-go informers."
url: "https://swe.quest/articles/how-the-controller-runtime-cache-actually-works-and-why-your-controller-does-adcfa1b97b0265c0"
canonical: "https://kubernetes.io/blog/2026/07/29/controller-runtime-cache-explained/"
source: "Kubernetes Blog"
published: "2026-07-29"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 32
tags: ["kubernetes","go","caching"]
---

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

A post on [Kubernetes Blog](https://swe.quest/sources/kubernetes.md), published 2026-07-29, 32 min read, Deep dive. Original: [https://kubernetes.io/blog/2026/07/29/controller-runtime-cache-explained/](https://kubernetes.io/blog/2026/07/29/controller-runtime-cache-explained/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Kubernetes](https://swe.quest/tags/kubernetes.md) (Infrastructure)
- [Go](https://swe.quest/tags/go.md) (Languages)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)

## Prerequisites

- Go ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))
- Kubernetes controllers ([easy posts on Kubernetes](https://swe.quest/tags/kubernetes.md?difficulty=easy))
- kubebuilder basics

## Keywords

controller-runtime, client-go, SharedIndexInformer, Reflector, RealFIFO, DeltaFIFO, workqueue, kubebuilder

## Related posts

- [Kubernetes v1.37: etcd RangeStream Cuts Memory Use on Large List Reads](https://swe.quest/articles/kubernetes-v1-37-etcd-rangestream-cuts-memory-use-on-large-list-reads-7b71582ef59abcc3.md): Kubernetes Blog · 2026-09-01 · Medium · 3 min read · Kubernetes, Memory management, Performance engineering
  Kubernetes v1.37 promotes etcd RangeStream to beta and enables it by default via the EtcdRangeStream feature gate.
- [Kubernetes v1.36: Server-Side Sharded List and Watch](https://swe.quest/articles/kubernetes-v1-36-server-side-sharded-list-and-watch-61238fc675ddead5.md): Kubernetes Blog · 2026-05-06 · Hard · 3 min read · Kubernetes, Scaling, Distributed systems
  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.
- [Slack’s Incident on 2-22-22](https://swe.quest/articles/slack-s-incident-on-2-22-22-7a35cde32cfb5fd8.md): Slack Engineering · 2022-04-26 · Medium · 12 min read · Incidents & postmortems, Caching, Resilience, MySQL, Distributed systems
  A Consul agent rolling restart caused Mcrib, Slack's memcached control plane, to replace and flush cache nodes, dropping hit rates during peak traffic.
- [Kubernetes Informers are so easy... to misuse!](https://swe.quest/articles/kubernetes-informers-are-so-easy-to-misuse-a7aef41b2bdd46d8.md): Render · 2025-08-26 · Medium · 7 min read · Kubernetes, Go, Resilience, Memory management
  Kubernetes Informers report the eventual current state of an object, not every intermediate transition, so controllers must use level-driven logic rather than comparing oldObj and newObj in UpdateFunc.
- [Fixed cadence to seconds: making ClickHouse Cloud autoscaling more reactive](https://swe.quest/articles/fixed-cadence-to-seconds-making-clickhouse-cloud-autoscaling-more-reactive-1b4745e879b2e9ce.md): ClickHouse · 2026-08-04 · Medium · 13 min read · Kubernetes, Capacity planning, Go, Analytics & OLAP, Event-driven architecture
  ClickHouse Cloud's vertical autoscaling recommender moved from a fixed timer loop to a controller-runtime based design, so services that hit memory pressure get a recommendation in seconds instead of waiting for the next scheduled pass.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
