Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Kubernetes's Scheduler?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the Scheduler of Kubernetes". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the Scheduler of Kubernetes".

Scheduling process

Kube-scheduler is the scheduler of kubernetes. Its main function is to schedule Pod to the appropriate Node node according to specific scheduling algorithm and scheduling policy. It is an independent binary program. After startup, it will listen to APIServer all the time, get the Pod with empty PodSpec.NodeName, and create a binding for each Pod.

Predicates

The Predicates phase first traverses all the nodes, filtering out the nodes that do not meet the conditions, which is a mandatory rule. All the Node output in this stage will be recorded and used as the input of the second stage. If all the nodes are not satisfied with the conditions, then the Pod will remain in the Pending state until some nodes meet the conditions, during which the scheduler will keep retrying.

Priorities

In the Priorities phase, the nodes are filtered again. If multiple nodes meet the conditions, the nodes are sorted according to the priority (priorites) of the nodes. Finally, the node with the highest priority is selected to deploy the Pod application.

LeastRequestedPriority: determine the weight by calculating the utilization rate of CPU and memory. The lower the utilization rate, the higher the weight. Of course, it is also normal that the lower the utilization rate of the resource, the higher the weight, the more likely it is to run other Pod.

SelectorSpreadPriority: for better high availability, schedule multiple Pod replicas under the same Deployment or RC to multiple different nodes as far as possible. When a Pod is scheduled, it will first look up the corresponding controller of the Pod, and then check the existing Pod under the controller. The less Pod runs, the higher the weight of the node.

ImageLocalityPriority: if there is already a mirror node to be used on a node, the larger the total size of the image, the higher the weight

NodeAffinityPriority: this is to calculate a weight value based on the affinity of the node. Later, we will explain the use of affinity in detail.

Node scheduling affinity node hard compatibility

RequiredDuringSchedulingIgnoredDuringExecution

Method 1: Pod uses spec.nodeSelector (based on equivalence)

Method 2: Pod uses spec.affinity to support matchExpressions attributes (complex tag selection mechanism)

Node soft compatibility

Flexible control logic, when the condition is not satisfied, it can accept the weight weight to be arranged on other unqualified nodes to define the priority. The higher the value, the higher the priority.

Stains and tolerance

A stain taints is key-type attribute data defined on a node, which is used to make a node refuse to run Pod scheduling on it.

Unless Pod has tolerance for receiving node stains, tolerations is key attribute data defined on Pod.

Used to configure tolerable stains, and the scheduler dispatches Pod to nodes on which it can tolerate node stains or no stains

On the node of

The machine is completed by using PodToleratesNodeTaints pre-selection strategy and TaintTolerationPriority optimization function.

System

Node affinity makes Pod objects attracted to a specific class of nodes (nodeSelector and affinity)

Stains provide the ability for nodes to repel specific Pod objects

(1) define stains and tolerance

Stain is defined in nodes.spec.taints tolerance is defined in pods.spec.tolerations

Syntax: key=value:effect

(2) effect defines the exclusion level:

NoSchedule cannot be tolerated, but only affects the scheduling process, and the scheduled pod is not affected, only for the newly added

Pod takes effect.

PreferNoSchedule, flexible constraint, node existing Pod is not affected, if there is no matching node, also

It can be dispatched up.

NoExecute, cannot be tolerated, when the stain changes, the Pod object will be expelled

(3) when defining tolerance on Pod: equivalent comparison tolerance and stain match perfectly in key, value and effect.

Existence judgment key and effect match exactly, value uses null value

A node can be configured with multiple stains, and a Pod can have multiple tolerances.

Thank you for your reading, the above is the content of "what is the Scheduler of Kubernetes". After the study of this article, I believe you have a deeper understanding of what the Scheduler of Kubernetes is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 260

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report