Horizontal Pod Autoscaling during Kubernetes deployments

Aug 10, 2022 by Parth Srivastav

Autoscaling, which helps to optimize utilization and minimize costs, is one of the most important aspects of cloud computing. Autoscaling dynamically allocates resources to your cloud application based on load. It handles bursts of load and traffic during peak hours, ensuring that end user experience is not degraded. Autoscaling also guarantees that you don’t have servers running idle and costing you money in the non-peak hours.

Autoscaling in Kubernetes

In the Kubernetes world, there are 3 different autoscalers that help manage costs and resource optimization:

HPA presents unique challenges when used in conjunction with advanced deployment strategies like Blue/Green. For instance, one of our customers wanted to use a Blue/Green strategy to move all users on the old version to the new version without interruption. However, what our customer discovered was that HPA scaled down the next version as it was not receiving any traffic. This meant that end users saw slow/degraded service for a while when traffic cut over to the next version. When Armory set out to add support for HPA within Continuous Deployments-as-a-Service, we wanted to provide reliability when using deployment strategies without having to increase costs for our customers. Here’s what we came up with.

How Armory’s Continuous Deployment-as-a-Service optimizes HPA during deployment

Step 1: Before starting a deployment to an environment, CD-as-a-Service notes the scale that your application is currently running at and maintains this scale until the deployment to the environment is finished.

The Details: Because CD-as-a-Service knows the scale right before the deployment starts, it can alter deployment strategies in a way that does not cause degraded service. For example, when using a Blue/Green strategy, the next version of the application is scaled up to meet the current traffic load before traffic is moved over to the new version. Once the traffic is cut over to the new version, your users would not experience interruptions or degraded service. Additionally, this approach ensures reliability and speed when rolling back – your rollbacks don’t have to scale up to support the required traffic.

Step 2: CD-as-a-Service then disables the HPA for your application and executes your deployment strategy.

The Details: By disabling HPA during the deployment strategy, CD-as-a-Service ensures that HPA does not interfere with that strategy. For example, when using automated analysis results, if the new version has a memory leak, the HPA could scale up and thwart the threshold-based queries. Or during pod-ratio canary deployments, HPA could scale down pods and force more users into the canary version of application.

Step 3: After successfully deploying the new version of the application, CD-as-a-Service then enables HPA for the new version of the application.

The Details: CD-as-a-Service deploys every change you make, even changes to the HPA. That means as you refine your HPA configuration to the application’s needs, you can run automated performance tests in staging environments before ever deploying new HPA configurations to production.

In Conclusion:

With CD-as-a-Service, you can leverage all the benefits of HPA alongside advanced deployment strategies to deploy reliably without causing service interruptions. You can start using HPA with your applications by adding it to the list of manifests without adding any extra configuration. Test out your own HPA deployment scenarios by trying CD-as-a-Service for free by signing up today!

Share this post:

Recently Published Posts

Continuous Deployments meet Continuous Communication

Sep 7, 2023

Automation and the SDLC Automating the software development life cycle has been one of the highest priorities for teams since development became a profession. We know that automation can cut down on burnout and increase efficiency, giving back time to ourselves and our teams to dig in and bust out innovative ideas. If it’s not […]

Read more

Happy 7th Birthday, Armory!

Aug 21, 2023

Happy 7th birthday, Armory! Today we’re celebrating Armory’s 7th birthday. The parenting/startups analogy is somewhat overused but timely as many families (at least in the US) are sending their kids back to school this week. They say that parenting doesn’t get easier with age – the challenges simply change as children grow, undoubtedly true for […]

Read more

Visit the New Armory Developer Portal

Aug 11, 2023

Easier Access to Tutorials, Release Notes, Documentation, and More! Developer Experience (DX) is one of Armory’s top focuses for 2023. In addition to improving developer experience through Continuous Deployment, we’re also working hard to improve DX for all of our solutions.  According to ThoughtWorks, poor information management and dissemination accounts for a large percentage of […]

Read more