How can I ensure some pods are always on separate nodes without breaking the autoscaling?

0
0
Asked By MysteriousPenguin42 On

Hey everyone! I've been digging into how to manage pod deployments, but no luck so far and I could really use some help. I'm trying to find a way to make sure that at least a few of our pods are distributed across different nodes, but the catch is that I don't want to enforce a rule that forces all autoscaled pods to be on separate nodes, since that drives up costs significantly.

My goal is to maintain some node separation initially—like keeping the first two or three pods on different nodes—while allowing the autoscaled pods to be scheduled more freely afterwards. I've considered splitting my service into multiple deployments, but that clouds the autoscaling logic, which might lead to an overloaded pod and a failure to scale when necessary.

So, is it possible to set different affinity settings for the autoscaled pods versus the initial ones? Or am I overthinking this? Any insights would be greatly appreciated! Thanks a ton, I'm pretty drained from all this!

3 Answers

Answered By HelpfulLinkFinder On

You can explore the Kubernetes documentation on topology spread constraints [here](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/). It might have the answers you're looking for!

MysteriousPenguin42 -

Thanks for the link! I’ll need to analyze it further to see if it can ensure that at least two pods always land on separate nodes. I’m fine with later pods clustering together, but those first two need to be apart. Really appreciate your help!

Answered By CloudNinja99 On

If you set your anti-affinity rules to preferred instead of required, the scheduler is more flexible with placement. Also, topology spread constraints might do exactly what you need!

Answered By TechSavvy86 On

You should check out topology spread constraints and look into using maxSkew. MaxSkew allows you to limit how many pods can be scheduled on the same node versus others, which could help achieve your goal without breaking the bank on resource allocation.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.