![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
Technically, containerization should be more cost-effective by default, but Kubernetes is riddled with expensive cost traps that may cause you to go over your budget. Fortunately, you have a few tactics to keep cloud costs at bay, and autoscaling is one of them. Kubernetes comes with three built-in autoscaling mechanisms to help you do that. The tighter they’re configured, the lower the costs of running your application.
Keep on reading to learn how these autoscaling mechanisms help to reduce your AWS bill for Kubernetes.
Many applications experience fluctuating usage, which means that adding or removing pod replicas is in your best interest. This is where Horizontal Pod Autoscaler (HPA) helps by doing that automatically.
It works great for scaling stateless applications, but is also a good match for stateful sets. To get the highest cost savings for workloads where demand changes regularly, use HPA together with cluster autoscaling. This will reduce the number of active nodes when the number of pods decreases.
HPA monitors pods to understand whether the number of pod replicas needs to change. To determine this, it takes the mean of a per-pod metric value and checks whether removing or adding replicas would bring that value closer to the target.
For example, if your deployment’s target CPU utilization is 50% and right now you have five pods running there, your mean CPU utilization is 75%. To bring the pod average closer to your target, the HPA controller will add three replicas.
This autoscaling mechanism increases and reduces the CPU and memory resource requests of pod containers to align the allocated cluster resources with actual usage. VPA also needs access to the Kubernetes metrics server since it replaces only pods that are managed by a replication controller.
Tip: Use VPA and HPA at the same time if your HPA configuration doesn’t use CPU or memory to set its scaling targets.
A workload might experience high utilization at one point or another, but increasing its request limits permanently is a bad idea. You risk wasting CPU or memory resources and limiting the nodes running them. Spreading a workload across multiple application instances is tricky; this is where Vertical Pod Autoscaler helps.
VPA deployment consists of three components:
Since Kubernetes doesn’t allow making changes in the resource limits of running pods, VPA first terminates pods using outdated limits and then injects the updated values to the new pod specification.
Cluster Autoscaler alters the number of nodes in a cluster on supported platforms. Since the autoscaler controller works on the infrastructure level, it needs permissions to add and delete infrastructures, and you should manage these credentials securely (for example, following the principle of least privilege).
This autoscaling mechanism works well if you’re looking to optimize costs by dynamically scaling the number of nodes to fit the current cluster utilization. It’s a great tool for workloads designed to scale and meet dynamic demand.
It checks for unschedulable pods and then calculates whether it’s possible to consolidate all of the pods deployed currently to run them on a smaller number of nodes. If Cluster Autoscaler identifies a node with pods that can be rescheduled to other nodes in the cluster, it evicts them and removes the spare node.
These native autoscaling mechanisms are incredibly valuable for keeping cloud costs at bay, but they require significant manual configuration:
You probably see why automating this aspect of running Kubernetes clusters is a smart move. Just to give you an example, tools such as CAST AI can add new nodes automatically for the duration of the increased demand and then scale down immediately to reduce waste.
Here’s an example of what an automated autoscaling flow looks like:
If you run your Kubernetes clusters on Amazon Web Services‘ EKS, here’s something to help you take the first step: Generate a free Available Savings report and start optimizing your cloud costs.