Blogs / Why Kubernetes Watches Instead of Polling

Why Kubernetes Watches Instead of Polling

Why the Kubernetes post says it was built around a watch model rather than polling, and what it says the controller-runtime cache really is.

  • Learning
  • 1 min read

For: Learners new to Kubernetes controllers.

Watch instead of polling

To prevent that, Kubernetes was built around a watch model rather than polling from the very beginning.[1]

Pollingwhat Kubernetes was notbuilt aroundWatch modela snapshot once, then astream of changes
How does the post contrast polling with the watch model?

No loop asks what is in the world now

This is the list + watch pattern, and there is no "what is in the world right now?" loop anywhere in it.[1]

What the cache really is

So when people talk about "the controller-runtime cache", they are not talking about a clever optimization.[1]

Sources

  1. How the controller-runtime Cache Actually Works (kubernetes.io · checked )

More articles