I understand that kubelet
is responsible for taking PodSpecs (usually from the API Server) and running the Pod.
Kubernetes Components > Node Components > kubelet
"The kubelet takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthy."
But how does the API Server keep track of the status of each Pod (e.g. running / failed) ? Does kubelet
send regular requests to the API Server? Or does the API Server poll kubelet
regularly? Or some other mechanism?
kubelet does everything on the node. A typical process to create a pod would be the following:
Note: There are more components involved here, like scheduler and controller manager (mentioned in your post as various mechanisms), but I will skip them.
At this point kubelet will be in charge of this pod. If the pod goes down, kubelet will report api-server, api-server will give the order to kill the pod, will spin up a new one, and again will update etcd server.
One thing to point out is that all components in k8s talk to api-server directly. So, controller manager or scheduler do not say kubelet what to do. Rather they say it to api-server, and api-server to kubelet.