Closed guojianyu closed 2 weeks ago
I would like to confirm the core issue. Your question is, you wrote a custom plugin, and then found that only the filter method was executed, but the score method was not executed, right? You can first check how many nodes your test cluster has. If there is only a single node, the scheduler will only use this node for scheduling by default and will not execute scoring process. refer to: https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/schedule_one.go#L428
Please forgive me if my understanding is wrong.
I would like to confirm the core issue. Your question is, you wrote a custom plugin, and then found that only the filter method was executed, but the score method was not executed, right? You can first check how many nodes your test cluster has. If there is only a single node, the scheduler will only use this node for scheduling by default and will not execute scoring process. refer to: https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/schedule_one.go#L428
Please forgive me if my understanding is wrong.
Thank you very much for your reply,You understood me well, but my questions were not clear enough.According to the code you provided, I can understand that the scoring method did not execute, but the queuesort method did not execute, I understand that queuesort has nothing to do with the number of nodes.I hope you can guide me,Thank you!!
queueSort: enabled:
- name: nodeAge disabled:
- name: "*"
You can confirm whether the configuration is correct.
queueSort: enabled:
- name: nodeAge disabled:
- name: "*"
You can confirm whether the configuration is correct.
I0617 10:38:41.617760 29590 configfile.go:101] "Using component config" config=<
apiVersion: kubescheduler.config.k8s.io/v1
clientConnection:
acceptContentTypes: ""
burst: 100
contentType: application/vnd.kubernetes.protobuf
kubeconfig: /etc/kubernetes/scheduler.conf
qps: 50
enableContentionProfiling: true
enableProfiling: true
kind: KubeSchedulerConfiguration
leaderElection:
leaderElect: false
leaseDuration: 15s
renewDeadline: 10s
resourceLock: leases
resourceName: kube-scheduler
resourceNamespace: kube-system
retryPeriod: 2s
parallelism: 16
percentageOfNodesToScore: 0
podInitialBackoffSeconds: 1
podMaxBackoffSeconds: 10
profiles:
- pluginConfig:
- args:
apiVersion: kubescheduler.config.k8s.io/v1
kind: DefaultPreemptionArgs
minCandidateNodesAbsolute: 100
minCandidateNodesPercentage: 10
name: DefaultPreemption
- args:
apiVersion: kubescheduler.config.k8s.io/v1
hardPodAffinityWeight: 1
ignorePreferredTermsOfExistingPods: false
kind: InterPodAffinityArgs
name: InterPodAffinity
- args:
apiVersion: kubescheduler.config.k8s.io/v1
kind: NodeAffinityArgs
name: NodeAffinity
- args:
apiVersion: kubescheduler.config.k8s.io/v1
kind: NodeResourcesBalancedAllocationArgs
resources:
- name: cpu
weight: 1
- name: memory
weight: 1
name: NodeResourcesBalancedAllocation
- args:
apiVersion: kubescheduler.config.k8s.io/v1
kind: NodeResourcesFitArgs
scoringStrategy:
resources:
- name: cpu
weight: 1
- name: memory
weight: 1
type: LeastAllocated
name: NodeResourcesFit
- args:
apiVersion: kubescheduler.config.k8s.io/v1
defaultingType: System
kind: PodTopologySpreadArgs
name: PodTopologySpread
- args:
apiVersion: kubescheduler.config.k8s.io/v1
bindTimeoutSeconds: 600
kind: VolumeBindingArgs
name: VolumeBinding
plugins:
bind: {}
filter:
enabled:
- name: nodeAge
weight: 0
multiPoint:
enabled:
- name: PrioritySort
weight: 0
- name: NodeUnschedulable
weight: 0
- name: NodeName
weight: 0
- name: TaintToleration
weight: 3
- name: NodeAffinity
weight: 2
- name: NodePorts
weight: 0
- name: NodeResourcesFit
weight: 1
- name: VolumeRestrictions
weight: 0
- name: EBSLimits
weight: 0
- name: GCEPDLimits
weight: 0
- name: NodeVolumeLimits
weight: 0
- name: AzureDiskLimits
weight: 0
- name: VolumeBinding
weight: 0
- name: VolumeZone
weight: 0
- name: PodTopologySpread
weight: 2
- name: InterPodAffinity
weight: 2
- name: DefaultPreemption
weight: 0
- name: NodeResourcesBalancedAllocation
weight: 1
- name: ImageLocality
weight: 1
- name: DefaultBinder
weight: 0
- name: SchedulingGates
weight: 0
permit: {}
postBind: {}
postFilter: {}
preBind: {}
preEnqueue: {}
preFilter: {}
preScore: {}
queueSort:
disabled:
- name: '*'
weight: 0
enabled:
- name: nodeAge
weight: 0
reserve: {}
score:
enabled:
- name: nodeAge
weight: 0
schedulerName: my-scheduler
>
This is the scheduler output configuration, configuration should be no problem, I tested https://github.com/kubernetes-sigs/scheduler-plugins/tree/master/pkg/qos also no log output, this is very strange
I've found the cause, the pod schedule is too fast to cause the problem, the queuesort method will not be called if the queue length is equal to 1
Area
Other components
No response
What happened?
schduler-plugin calls the filter interface but does not call (sort,score) types of interfaces. The code is as follows:
The Scheduler_config.yaml is as follows:
scheduler-deploy.yaml:
The scheduler log output is as follows:
Is this a problem with my code or something else? If it is a code problem, how can I fix it? Thank you very much!! 🙏
What did you expect to happen?
Sort and Score interface can be called normally.
How can we reproduce it (as minimally and precisely as possible)?
No response
Anything else we need to know?
I upgraded the scheduler-plugin to the latest version with the same problem
Kubernetes version
Scheduler Plugins version
release-1.26