0

Consider that I have two pods: one is serving webpages and another is performing consistent computation, like a Flask server on one pod and a Spark Executor as the other.

Suddenly a new feature creates lots of traffic for a specific route on the Flask server. Normally the Executor is numeric and consistent and the Flask server is sparse and memory/IO bound but this causes the workloads to be very similar and stalls the CPU on this Node.

Can Kubernetes' scheduler identify this and reschedule the pod?

Bots Fab
  • 3
  • 1

1 Answers1

1

No, it does not work this way.

K8s does not track pod's cpu/memory/io once they get scheduled. It's up to you to measure it and make changes to your deployment.

I'm not saying it couldn't be done. All I am saying is that k8s is not doing it out of the box and also I don't know of any third party solutions that do this.

Here is my suggestion what you can do:

Since you know that you dont want flask and spark work together you can use affinity feature. To be more specific: podAntiAffinity


One more thing you could do is to set pod resource limits/request.

In this way you can make sure that a pod uses only the ammount of resources it's allowed to use and as a result it won't stall a node. It's generally considered a good practice to add pod resource constraints.

Matt
  • 528
  • 3
  • 7