When watching a replication controller, it returns it’s most recent replicas
count under ReplicationControllerStatus
. I could not find anywhere in the documentation what the status of the pod needs to be, in order for it to be included there. Is it enough for the pod to be scheduled? I’ve noticed a replication controller reporting pods in it’s status even if the pods are still pending.
Very interesting question! For that to answer I believe we need to walk the Star Wars walk and Use The Source:
UPDATE: My colleague Stefan Schimanski just pointed out to me that in fact the answer is a bit more complicated; key is FilterActivePods:
func FilterActivePods(pods []api.Pod) []*api.Pod {
var result []*api.Pod
for i := range pods {
if api.PodSucceeded != pods[i].Status.Phase &&
api.PodFailed != pods[i].Status.Phase &&
pods[i].DeletionTimestamp == nil {
result = append(result, &pods[i])
}
}
return result
}
This means the ultimate condition is: pods which have not terminated yet and are not in graceful termination.
Note that the definition of 'scheduled' in the context of Kubernetes is simply
pod.spec.nodeName != ""
The Kubelet on a specific node watches the API Server for pods that have a matching nodeName
and will then launch the pod on said node.