Kubernetes scheduler¶
The Kubernetes scheduler is a critical control plane component responsible for assigning Pods to specific Nodes within a cluster^[400-devops-06-kubernetes-k8s-paas-readme.md]. It operates by watching for newly created Pods that have no Node assigned and selecting an optimal node for them to run on^[400-devops-06-kubernetes-k8s-paas-readme.md].
Scheduling Workflow¶
The scheduler's decision-making process is typically divided into two main phases:
- Filtering (Predicate): The scheduler identifies all feasible Nodes that can accommodate the Pod based on hard constraints, such as resource requests (CPU, memory), hardware requirements, or specific taints and tolerations^[400-devops-06-kubernetes-k8s-paas-readme.md]. Nodes that do not meet these mandatory criteria are eliminated.
- Scoring (Priority): The remaining Nodes are ranked based on a scoring algorithm. The scheduler applies various priority functions—such as resource utilization, data locality, or soft affinity rules—to determine the "best" fit for the workload^[400-devops-06-kubernetes-k8s-paas-readme.md].
The Node with the highest score is selected, and the scheduler binds the Pod to that Node^[400-devops-06-kubernetes-k8s-paas-readme.md].
Key Features¶
- Resource Model & Management: The scheduler relies on Kubernetes' resource model to understand the available capacity (CPU, memory) on each Node and the requirements of each Pod^[400-devops-06-kubernetes-k8s-paas-readme.md].
- Extensibility: While Kubernetes provides a default scheduling strategy, the system allows for custom scheduling logic through "Scheduler Profiles" or custom schedulers^[400-devops-06-kubernetes-k8s-paas-readme.md].
- Priorities and Mandatory Mechanisms: The implementation uses a combination of "Priorities" (preferences) and "Mandatory" requirements (hard constraints) to ensure stability while optimizing for cluster efficiency^[400-devops-06-kubernetes-k8s-paas-readme.md].
Related Concepts¶
- Pod
- [[Node]]
- Kubernetes
- [[Resource Management]]
Sources¶
400-devops-06-kubernetes-k8s-paas-readme.md