Published on

K8s系列 - 调度器scheduler

Authors
  • avatar
    Name
    Guming
    Twitter

Scheduler 是 Kubernetes 的核心组件,它的主要功能是为待运行的工作负载 Pod 绑定运行的节点 Node

早起的K8s 一直都在使用Predicates和Priorities来管理不同的调度算法, 直到 v1.15.0 开始引入调度框架。本文 以 v1.19.0展开说明。

Predicates and Priorities Scheduling

type genericScheduler struct {
	cache                    schedulerinternalcache.Cache
	schedulingQueue          internalqueue.SchedulingQueue
	predicates               map[string]predicates.FitPredicate
	priorityMetaProducer     priorities.PriorityMetadataProducer
	predicateMetaProducer    predicates.PredicateMetadataProducer
	prioritizers             []priorities.PriorityConfig
	pluginSet                pluginsv1alpha1.PluginSet
	extenders                []algorithm.SchedulerExtender
	lastNodeIndex            uint64
	alwaysCheckAllPredicates bool
	nodeInfoSnapshot         schedulerinternalcache.NodeInfoSnapshot
	volumeBinder             *volumebinder.VolumeBinder
	pvcLister                corelisters.PersistentVolumeClaimLister
	pdbLister                algorithm.PDBLister
	disablePreemption        bool
	percentageOfNodesToScore int32
}