Cloud Technology

How can I reduce Kubernetes costs by using Horizontal Pod Autoscalers and Spot Instances together?

BR Asked by Brandon Taylor · 20-01-2025
0 upvotes 17,232 views 0 comments
The question

Our cloud bill is skyrocketing and I need to optimize our resource usage. I am considering moving our non-critical workloads to Spot/Preemptible instances while using HPA to handle traffic spikes. Are there specific pitfalls when mixing HPA with cluster autoscalers on Spot nodes, especially regarding pod eviction and graceful termination during node reclamation?

3 answers

0
PA
Answered on 05-03-2025

Mixing HPA with Spot instances is the ultimate way to save up to 80% on compute costs, but it requires a very robust architecture. You must implement a 'Pod Disruption Budget' (PDB) to ensure a minimum number of replicas stay alive during a mass reclamation. Also, ensure your application handles SIGTERM signals gracefully; you only get a 30-second warning before a Spot node is taken back. We use a "fallback" node pool of On-Demand instances with lower priority so that if Spot capacity disappears, our HPA can still schedule pods on reliable hardware. This "weighted" approach saved us $5k last month.

0
KE
Answered on 12-03-2025

Have you tried using Vertical Pod Autoscaler (VPA) in 'Recommendation' mode alongside HPA to see if your initial resource requests are just set too high to begin with?

ST 15-03-2025

Kevin, that's a brilliant suggestion. Many teams over-provision because they don't know their app's actual footprint. By using VPA for insights and HPA for scaling, you get the best of both worlds. It prevents the cluster from requesting massive nodes for pods that only actually use 10% of their allocated CPU. This "right-sizing" is often more effective than just switching to cheaper instances.

0
ME
Answered on 25-03-2025

I recommend looking into 'Karpenter' if you are on AWS. It handles the bin-packing and node selection much more efficiently than the standard Cluster Autoscaler.

BR 28-03-2025

I second the Karpenter recommendation. It's much faster at spinning up new nodes during HPA triggers compared to the old-school autoscaler logic.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session