Kubernetes core principle (c) of the Scheduler

1. Scheduler Introduction

Scheduler responsible for Pod scheduling. Since the entire system "nexus" role, bearing on: responsible for receiving Controller Manager to create a new Pod, for selecting an appropriate Node; under Kai: kubelet on Node takeover Pod life cycle.

Scheduler:

1) selected by the scheduling algorithm to be scheduled for each Pod Pod from the Node list a list of the most suitable Node, and write information in etcd

2) kubelet monitored through the API Server Pod to produce binding information kubernetes Scheduler, and then get a list of corresponding Pod, download the Image, and launch container.

scheduler

2. Scheduling Process

1, pre-scheduling process, i.e., through all the target Node, selected to meet the requirements of the candidate nodes, a plurality of pre-built Kubernetes strategy (xxx Predicates) for users to select

2, to determine the optimal node, using the preferred strategy (xxx Priority) calculates the integral for each candidate node in the first step on the basis of, take the highest points.

Scheduling process by loading the plug-in "scheduling algorithm provided by" (AlgorithmProvider) specific implementation, a scheduling algorithm is provided by a structure comprising a set of a preselected group of preferred strategy and policy.

3. The pre-selection strategy

Description: Returns true if the node satisfies the conditions of the scheduling the Pod; return false indicates that the node does not satisfy the conditions of the scheduling the Pod.

3.1. NoDiskConflict

Alternatively, Pod determined whether the data volume of the data volume already exists conflict Pod mounted with the Node, if it returns false, true otherwise.

3.2. PodFitsResources

Alternatively, determining whether the node resources to meet the needs of Pod Alternatively, the node remaining resources i.e. full use of the resources does not satisfy the Pod.

  1. Alternatively, Pod and calculating the sum of the used resource node (the resource node used for all Pod) a.
  2. Alternatively, the node acquires status information including resource information node.
  3. If (alternatively resource nodes Pod +> total resources of the node) then returns false, i.e., does not satisfy the remaining resource use Pod; true otherwise.

3.3. PodSelectorMatches

Alternatively, Pod determines whether the node contains a tag specified by the tag selection, i.e., by selecting Node tab.

  1. Pod spec.nodeSelector If not specified, it returns true.
  2. Otherwise, the tag information obtaining alternative node, determining the tag information of the node contains the Pod spec.nodeSelector specified in the tag, if it contains returns true, otherwise returns false.

3.4. PodFitsHost

Alternatively, the determination Pod spec.nodeName designated alternate node name and the node name are the same, if the same returns true, otherwise returns false.

3.5. Check Node Label Presence

Check whether there is an alternative node label Scheduler configuration, if returns true, otherwise false.

3.6. CheckServiceAffinity

Alternatively, the label comprises determining whether the node Scheduler configuration, if there returns true, otherwise returns false.

3.7. PodFitsPorts

Alternatively, the port determines whether the list used in the Pod port is occupied in the alternative node, if occupied returns false, otherwise it returns true.

4. Preferably Policy

4.1. LeastRequestedPriority

Preference node with the smallest resource consumption (CPU + memory) from the candidate node list.

4.2. CalculateNodeLabelPriority

Node containing the indicated preference of the Label.

4.3. BalancedResourceAllocation

Preferred the most balanced resource usage node from the candidate node list.

Reference "Kubernetes Definitive Guide"

Guess you like

Origin www.cnblogs.com/malukang/p/11542177.html