kubernetes-sigs / descheduler

Descheduler for Kubernetes
https://sigs.k8s.io/descheduler
Apache License 2.0
4.36k stars 662 forks source link

threshold.pods settings not calculated right #1184

Closed EinavDanielDX closed 1 year ago

EinavDanielDX commented 1 year ago

What version of descheduler are you using?

descheduler version: 0.27.1

Please provide a copy of your deschedulerpolicy config file Using descheduler helm chart with the following settings

    deschedulerPolicy:
      nodeSelector: "my.node/role=general-purposes,my.node/persistency=spot"
      strategies:
        RemoveDuplicates:
          enabled: true
        RemovePodsHavingTooManyRestarts:
          enabled: true
          params:
            podsHavingTooManyRestarts:
              podRestartThreshold: 100
              includingInitContainers: true
        RemovePodsViolatingNodeTaints:
          enabled: true
        RemovePodsViolatingNodeAffinity:
          enabled: true
          params:
            nodeAffinityType:
            - requiredDuringSchedulingIgnoredDuringExecution
        RemovePodsViolatingInterPodAntiAffinity:
          enabled: true
        RemovePodsViolatingTopologySpreadConstraint:
          enabled: true
          params:
            includeSoftConstraints: false
        LowNodeUtilization:
          params:
            nodeResourceUtilizationThresholds:
              thresholds:
                # AND
                cpu: 50
                memory: 50
                Pods: 85
              targetThresholds:
                # OR
                cpu: 65
                memory: 65
                Pods: 95

What k8s version are you using (kubectl version)? v1.24.14-eks

What did you do? I'm trying to configure descheduler to rebalance my nodegroup according to memory and CPU only. I couldn't find a way to ignore the "pods" criteria. As a workaround I tried to set "threshold.pods=85" as and "targetThresholds.pods=95" and I get the following logs:

I0706 09:38:04.694987       1 profile.go:345] "Total number of pods evicted" extension point="Balance" evictedPods=0
I0706 09:38:04.695535       1 nodeutilization.go:201] "Node is overutilized" node="ip-X-Y-Z-163" usage=map[Pods:0 cpu:3150m memory:5856Mi pods:101] usagePercentage=map[cpu:39.823008849557525 memory:9.368629175801658 pods:50.5]
I0706 09:38:04.695570       1 nodeutilization.go:201] "Node is overutilized" node="ip-X-Y-Z-220" usage=map[Pods:0 cpu:6250m memory:25592Mi pods:144] usagePercentage=map[cpu:79.01390644753477 memory:40.94295728605123 pods:72]
I0706 09:38:04.695601       1 lownodeutilization.go:134] "Criteria for a node under utilization" CPU=50 Mem=50 Pods=20 Pods=85
I0706 09:38:04.695616       1 lownodeutilization.go:135] "Number of underutilized nodes" totalNumber=0
I0706 09:38:04.695631       1 lownodeutilization.go:148] "Criteria for a node above target utilization" CPU=65 Mem=65 Pods=50 Pods=95
I0706 09:38:04.695645       1 lownodeutilization.go:149] "Number of overutilized nodes" totalNumber=2
I0706 09:38:04.695660       1 lownodeutilization.go:152] "No node is underutilized, nothing to do here, you might tune your thresholds further"

The logs are indicating the descheduler is not working properly, since according to my settings, node "ip-X-Y-Z-163" should be underutilized. Also, the logs prints "Pods" Criteria twice "Criteria for a node above target utilization" CPU=65 Mem=65 Pods=50 Pods=95.

I would like to understand what is Pods Criteria, since I could not find a reference in the docs. How does the percentage being calculated? How can I ignore this Criteria? Why is it being printed twice in the log?

EinavDanielDX commented 1 year ago

How embarrassing, I figured I set "Pods", with a capital "P", instead of "pods".. pods are being ignored now.

damemi commented 1 year ago

@EinavDanielDX glad you figured out the problem, maybe we could do something to catch or prevent case errors like this