In which part of the codes, the scheduler gets pod and node information from the etcd and API server in kubernetes?

6/14/2019

Based on the GitHub repository as follow:

https://github.com/kubernetes/kubernetes

-- HamiBU
kubernetes

1 Answer

6/14/2019

you need to refer the below file

https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/core/generic_scheduler.go

below code snippet retrieves all the available nodes and a node is identified that is best suitable for running a specific pod

    nodes, err := nodeLister.List()
    if err != nil {
        return result, err
    }
    if len(nodes) == 0 {
        return result, ErrNoNodesAvailable
    }

    if err := g.snapshot(); err != nil {
        return result, err
    }

    trace.Step("Computing predicates")
    startPredicateEvalTime := time.Now()
    filteredNodes, failedPredicateMap, err := g.findNodesThatFit(pod, nodes)
-- P Ekambaram
Source: StackOverflow