jamiehannaford / what-happens-when-k8s

🤔 What happens when I type kubectl run?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The frequency of Kubelet querying apiserver

z1cheng opened this issue · comments

Thanks for your repo to help understand Kubernetes!

Have a question about the frequency of Kubelet querying apiserver:

It queries Pods from kube-apiserver every 20 seconds (this is configurable)

https://github.com/jamiehannaford/what-happens-when-k8s/blob/master/README.md?plain=1#L256C72-L256C148

Kubelet has fileCheckFrequency and httpCheckFrequency config, the default: 20 seconds, but there is no config for apiserver query frequency. And kubelet creates a reflector to do listAndWatch for pods resource, which can first list all items and then constantly watch items on a long connection with apiserver, so even if kubelet has a frequency config, it can't take effect :(

See code: https://github.com/kubernetes/kubernetes/blob/v1.14.0/pkg/kubelet/kubelet.go#L277C1-L309C3 and kubelet command-line doc https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/#synopsis (sorry, not found v1.14 doc)

Please let me know if any different opinions :)