Balancing Kubernetes Workloads with the Descheduler and Related Tools
This article explains why Kubernetes does not automatically rebalance pods, demonstrates how to use the Descheduler, Node Problem Detector, and Cluster Autoscaler together to detect node pressure, evict overloaded pods, and scale down underutilized nodes for improved cluster efficiency.
By default, Kubernetes does not recompute or rebalance workloads, which can lead to some nodes being over‑utilized while others host only a few pods.
The article walks through a scenario where a single‑node cluster that can host two pods is scaled to a second node, yet the scheduler does not automatically move pods to achieve balance.
It explains that a Deployment only defines a pod template and the desired replica count; without specifying one replica per node, the ReplicaSet will simply maintain the total number of pods and take no further action.
To address the lack of automatic rebalancing, the Descheduler can be deployed (as a Job, CronJob, or Deployment) to periodically scan the cluster and evict pods based on policies such as node utilization, pod age, failed pods, duplicates, and affinity or taint violations.
When a pod is evicted, the ReplicaSet creates a replacement pod, and the scheduler is likely to place it on a less‑utilized node, gradually improving balance.
Additional strategies include using the RemoveDuplicate plugin to eliminate similar pods on the same node, and policies that delete pods older than a certain threshold (e.g., seven days).
The article also describes combining the Descheduler with the Node Problem Detector, which reports node conditions like PIDPressure or MemoryPressure, allowing the node controller to taint problematic nodes.
After a node is tainted, the Descheduler can evict workloads that do not tolerate the taint, causing them to be scheduled elsewhere in the cluster.
Eventually, the under‑utilized node may fall below the Cluster Autoscaler’s scale‑down threshold, becoming a candidate for removal, thereby reducing costs.
Finally, the Descheduler is not installed by default but can be added to a cluster to maintain efficiency, and the article provides a link to its GitHub repository for more information.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.