惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
量子位
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
J
Java Code Geeks
B
Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
F
Fortinet All Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
A
About on SuperTechFans
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
H
Help Net Security
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How Kubernetes v1.36 Fixes the Horizontal Controller Scal...
Pratheesh Sa · 2026-05-13 · via DEV Community

The Real Cost of Watching Everything

Run a horizontally scaled controller across a large Kubernetes cluster—say, three replicas of a custom resource controller in a 5,000-node cluster. Each replica receives the entire event stream from the API server. It deserializes every Pod, every ConfigMap, every change, filters out 66% of them, and discards the rest. Multiply that waste by dozens of controllers and you're burning CPU and bandwidth on work that never had to happen.

This is the scaling wall that Kubernetes operators hit, and Kubernetes v1.36 finally addresses it head-on with server-side sharded list and watch.

Why Client-Side Sharding Isn't Enough

Some controllers already implement horizontal sharding—tools like kube-state-metrics assign each replica a slice of the keyspace and discard irrelevant objects locally. Sounds reasonable until you map the actual costs:

  • Deserialization waste: N replicas each deserialize the full event stream, even though (N-1) of them will throw away most of it.
  • Network scales wrong: Bandwidth grows with the number of replicas, not shrinks with the shard size. Three replicas = three times the API server egress.
  • CPU efficiency tanks: Every CPU cycle spent parsing objects you'll discard is a cycle you could've spent on actual work.

The problem isn't the sharding logic—it's that all filtering happens after the data leaves the API server. You're paying the full cost upfront, then hoping the controller will do the right math on its end.

Server-Side Sharding Changes the Game

Instead of filtering downstream, Kubernetes v1.36 moves the filter upstream. Controllers now tell the API server exactly which slice of the keyspace they own, and the API server only sends matching events.

The mechanism is deceptively simple: a new shardSelector field in ListOptions lets you specify a hash range. When you request:

opts := metav1.ListOptions{
    ShardSelector: &metav1.ShardSelector{
        Index: 0,          // This replica is shard 0
        Total: 3,          // Out of 3 total shards
    },
}

pods, err := clientset.CoreV1().Pods(metav1.NamespaceAll).List(ctx, opts)

Enter fullscreen mode Exit fullscreen mode

The API server hashes each object's namespace and name, maps it to a shard range, and filters at the source. Only events matching your shard ever leave the server.

What Actually Changes for You

Immediate wins:

  • Lower per-replica CPU: No wasted deserialization cycles. Each replica only processes what it owns.
  • Reduced network: API server sends 1/N of the traffic per replica. Scale to 10 replicas? You've slashed per-replica egress by 90%.
  • Better controller responsiveness: Smaller event streams mean faster reconciliation loops and lower latency on watch operations.

Tradeoffs to know:

  • This is alpha in v1.36, so expect the API surface to evolve. Don't ship it to production yet.
  • Your controller code needs to know its shard assignment and pass it on every list/watch call. If you're using a framework like kubebuilder, watch for patches that handle this automatically.
  • Hash collisions are handled deterministically—objects map to shards based on fnv.New32a hash of their namespace/name. The distribution is uniform as long as your keyspace is reasonably large.

A Concrete Migration Path

If you maintain a horizontally scaled controller or metrics exporter:

  1. Check the feature gate: ServerSideShardedListAndWatch=true (alpha).
  2. Audit your watch/list calls: Any place where you're already doing client-side filtering is a candidate for server-side sharding.
  3. Implement shard assignment: Use a simple integer (e.g., from a downward API env var or StatefulSet ordinal) to determine your replica's shard.
  4. Test in a lab cluster first: The hash function is deterministic, but edge cases around large resource counts should be validated before production.
// Example: derive shard index from pod ordinal
ordinality := os.Getenv("ORDINAL") // "0", "1", "2", etc.
shardIndex, _ := strconv.Atoi(ordinality)
shardTotal := 3 // Replicas in your deployment

// Apply to every list/watch
opts.ShardSelector = &metav1.ShardSelector{
    Index: shardIndex,
    Total: shardTotal,
}

Enter fullscreen mode Exit fullscreen mode

Why This Matters Now

Kubernetes clusters are getting bigger, and the pressure on the API server is mounting. Every optimization that pushes filtering logic upstream—whether it's field selectors, label selectors, or now shard selectors—buys you headroom to scale controllers without hitting a resource wall.

Server-side sharded list and watch is especially important for anyone running high-cardinality watch operations: Pod controllers, node-level agents, cost optimizers, security scanners. For teams operating 1,000+ node clusters with dozens of custom controllers, this can be the difference between stable API server load and constant firefighting.

The Question for Your Cluster

Are your horizontally scaled controllers already doing some form of client-side sharding to stay sane? If so, server-side sharding is probably worth experimenting with in your next lab run. And if you're not doing sharding yet but you've got multiple replicas of a watcher—you're probably leaving performance on the table.

What's the largest cluster you're running, and how many custom controllers are watching the same resources? I'd love to hear whether this lands on your v1.36 roadmap.