How Kubernetes API Server watch mechanism works?

9/25/2019

Inside a kubenertes environment, there is an API Server which we can call to watch a ressource. We can call this API Server thanks a HTTP request (or WebSocket but this is not related to my question) and I wonder how the API server deals to never terminate this request and keep to notify the client of any change about the ressource.

EDIT : I mean the HTTP protocol is a request/response protocol, I know with HTTP2 we can keep a same TCP connection open to perform multiple requests but it sill has to be a request/response nature. So how the watch mechanism works with this request/response protocol ?

-- Kizux
kubernetes
kubernetes-apiserver

1 Answer

9/25/2019

Kubernetes stores all its resources inside etcd, a key-value store, and etcd provides a watch functionality that the Kubernetes API exploits.

You can read about the etcd watch specifics here.

-- Alassane Ndiaye
Source: StackOverflow