Skip to content

Bin Packing

Bin packing is a scheduling strategy that places pods as densely as possible on the fewest nodes.

Node 1 (Full)
Node 2 (Empty)
Bin packing consolidates workloads

Mental Model

Like packing a suitcase - you want to fit as much as possible in the smallest number of suitcases. Kubernetes can use bin-packing to consolidate workloads, leaving other nodes empty for scaling or maintenance.

YAML Example

# Set scheduler profile
apiVersion: kubescheduler.config.k8s.io/v1beta3
kind: KubeSchedulerConfiguration
profiles:
- pluginConfig:
  - name: NodeResourcesFit
    args:
      resources:
        - name: cpu
          weight: 1
        - name: memory
          weight: 1

Common Misconceptions

  • ✗Bin-packing always best - FALSE: Sometimes spreading is better
  • ✗Bin-packing reduces resource waste - TRUE: But can cause hotspots
  • ✗All schedulers use bin-packing - FALSE: Different strategies available

Key Takeaways

  • • Bin packing is a scheduling strategy that places pods as densely as possible on the fewest nodes.
  • • Like packing a suitcase - you want to fit as much as possible in the smallest number of suitcases. K...
  • • Check the YAML example for implementation details
  • • Be aware of the common misconceptions listed above
Kubernetes Cosmos•An interactive learning experience
Built by GLM 4.7