Search code examples
kubernetesscheduling

What is the optimal scheduling strategy for K8s pods?


Here is what I am working with. I have 3 nodepools on GKE

  1. n1s1 (3.75GB)
  2. n1s2 (7.5GB)
  3. n1s4 (15GB)

I have pods that will require any of the following memory requests. Assume limits are very close to requests.

1GB, 2GB, 4GB, 6GB, 8GB, 10GB, 12GB, 14GB

How best can I associate a pod to a nodepool for max efficiency?

So far I have 3 strategies.

For each pod config, determine the “rightful nodepool”. This is the smallest nodepool that can accommodate the pod config in an ideal world. So for 2GB pod it's n1s1 but for 4GB pod it'd be n1s2.

  1. Schedule a pod only on its rightful nodepool.
  2. Schedule a pod only on its rightful nodepool or one nodepool higher than that.
  3. Schedule a pod only on any nodepool where it can currently go.

Which of these or any other strategies will minimize wasting resources?

=======


Solution

  • Why would you have 3 pools like that in the first place? You generally want to use the largest instance type you can that gets you under 110 pods per node (which is the default hard cap). The job of the scheduler is to optimize the packing for you, and it's pretty good at that with the default settings.