Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Kubernetes Autoscaling
Kubernetes Autoscaling

Kubernetes Autoscaling: Build efficient, cost-optimized clusters with KEDA and Karpenter

Arrow left icon
Profile Icon Christian Melendez
Arrow right icon
Coming Soon Coming Soon Publishing in Dec 2025
$19.99 per month
eBook Dec 2025 420 pages 1st Edition
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Christian Melendez
Arrow right icon
Coming Soon Coming Soon Publishing in Dec 2025
$19.99 per month
eBook Dec 2025 420 pages 1st Edition
Subscription
Free Trial
Renews at $19.99p/m
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Info icon
You can access this book only when it is published in Dec 2025
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Kubernetes Autoscaling

1 Introduction to Kubernetes Autoscaling

Autoscaling is at the heart of an efficient and cost-effective Kubernetes cluster. Yet, many organizations struggle with resource management, often leading to significant financial waste or system failures. Understanding and implementing proper scaling can be the difference between a thriving, responsive system and one that's constantly on the brink of collapse.In this chapter, I'll introduce you to the concepts, strategies, and technologies surrounding autoscaling in Kubernetes, exploring its mechanisms, benefits, and challenges. You'll understand why scaling needs to evolve from a manual to an automatic process and how it has become an integral part of modern cloud-native architectures. I've worked with organizations that have achieved between 50% to 70% cost reduction in their compute expenses by making their Kubernetes clusters more efficient. This book aims to guide you on how you can achieve similar optimizations.In this...

Book conventions

The upcoming sections will introduce various new concepts, accompanied by hands-on examples that need active engagement with a Unix shell environment. To ensure clarity in the practical demonstrations, the book will adhere to the following conventions:

  • Every practical section will start with the "Hands-On" prefix.
  • Commands preceded by a $ symbol indicate actions you need to perform.
  • For shell commands or outputs that exceed the width of a single page, we'll use the \ character to break the line. The continuation of the command or output will appear on the subsequent line.

These guidelines will help you to interpret long commands or outputs more easily as we progress through the book.

Technical Requirements

To practice what you'll be learning throughout this book, you need to have access to a Kubernetes cluster. In this chapter, I'm offering two options for cluster creation: a local setup and a cloud-based solution in AWS. If you're just starting out or you want to focus solely on workload scaling in the upcoming chapters, the local option using Kind (Kubernetes in Docker) is a good choice. Alternatively, you could use Docker Desktop and turn on Kubernetes or use a Kubernetes playground like Killercoda or Play with Kubernetes.However, if you're eager to dive into the full cloud experience from the start, I'll also provide instructions for setting up an Amazon EKS cluster using Terraform. This option will give you a more realistic environment, closely mimicking production scenarios. Just remember, if you choose this route, to delete all resources after your study sessions to avoid unnecessary charges.To make the process as smooth as possible...

Scalability Foundations

Before I dive into how autoscaling works in Kubernetes, let me first talk about what scaling means in the context of computing systems.Scaling is the ability of a system to handle increasing amounts of work by adding resources to manage the load efficiently. It's a fundamental concept in computing that has become increasingly crucial in the era of cloud-native applications and microservices architectures. The true power of scaling lies in its automation - the ability to adjust resources dynamically without human intervention, which is essential for managing the rapid and unpredictable demand. The following diagram illustrates the pitfalls of static resource allocation:

Figure 1.1 – Challenges with static and manual infrastructure

As you can see in Figure 1.1, Overprovisioning wastes resources and increases costs, while Underprovisioning risks poor performance and potential system failures. Autoscaling offers a solution to both these problems. Consider...

Kubernetes Architecture

Before I dive into the specifics about autoscaling in Kubernetes, let's have a quick overview of the Kubernetes architecture and its components, especially those involved in the autoscaling aspect of Kubernetes.Assuming you're already familiar with Kubernetes, you know that each cluster is composed of several nodes where one or more components run (e.g., kube-apiserver, kube-scheduler, or kubelet). A node is essentially a server, machine, or instance. Depending on where you're hosting your Kubernetes cluster, you'll encounter different terminology. In this book, I'll stick with node. As shown in Figure 1.4, a very simplified version of the Kubernetes architecture, Kubernetes cluster nodes are grouped into two: 1) the Control Plane, and 2) the Data Plane.

Figure 1.4 – A very simple Kubernetes architecture overview Caption

In Figure 1.4, you can see the control plane nodes on the left side. TheseThe Control Plane nodes contain all...

Efficient Kubernetes Data Planes

Understanding how to optimize your Kubernetes data plane is crucial for building cost-effective, high-performing clusters that can adapt to changing workloads. To do so, we'll explore what efficiency means in the context of Kubernetes, why it's important, and the key factors that contribute to an efficient data plane. Then, I'll cover the challenges of achieving and maintaining efficiency, as well as strategies for optimizing resource utilization.

What do I mean by efficiency?

To answer this question, let's first talk about what efficiency means in a broader sense. Efficiency, in general terms, is the ability to accomplish a task with minimal waste of time and effort. It's about achieving the desired outcome while using the least number of resources possible. In other words, no wasting of resources. In a formula, as shown in Figure 1.5, it will be like this:

Figure 1.5 – Efficiency formula for compute resourcesCaption...

Kubernetes Autoscaling Categories

When working with Kubernetes, there are two primary categories of scaling that require attention, as alluded to earlier. The first category pertains to the application workloads, represented by pods, while the second category involves the underlying infrastructure of the data plane, specifically the nodes. This distinction is crucial because each category requires different approaches and tools for effective autoscaling.

Application Workloads

The first step in your Kubernetes efficiency journey focuses on application workloads, specifically the pods that run your applications. This is a critical starting point because it directly impacts how efficiently your cluster utilizes resources and responds to changing demands. Central to this optimization is setting appropriate resource requests for your pods. This is crucial because the kube-scheduler uses these requests to make decisions about pod placement. If requests are set too high, you may waste resources...

Hands-On: Creating a Kubernetes Cluster

Enough theory - it's time to get our hands dirty! Grab your computer, open your terminal, and prepare to dive into the practical side of Kubernetes autoscaling. In this section, I'll guide you through creating your very own Kubernetes cluster, providing you with a sandbox environment to experiment with the concepts we've discussed.If you already have a Kubernetes cluster that you could use to practice the workload autoscaling chapters, skip this section and go to the summary of the chapter.

Local Kubernetes cluster with Kind

Kind, short for Kubernetes in Docker, is a tool that enables you to create and manage local Kubernetes clusters by leveraging Docker containers as simulated nodes. It was primarily created for testing Kubernetes itself, but has become popular among developers for local development and continuous integration (CI) pipelines. Kind allows you to quickly spin up a multi-node Kubernetes cluster on your local machine...

Left arrow icon Right arrow icon

Key benefits

  • Autoscale Kubernetes workloads and infrastructure using KEDA and Karpenter
  • Improve performance, reduce cloud costs, and eliminate resource waste with smarter scaling
  • Work with hands-on labs, real-world use cases, and step-by-step guidance from the creator of Karpenter Blueprints
  • Free with your book: PDF Copy, AI Assistant, and Next-Gen Reader

Description

Kubernetes is the backbone of modern containerized infrastructure, but scaling it efficiently remains a challenge. Kubernetes Autoscaling equips cloud professionals with this comprehensive guide to dynamically scaling applications and infrastructure using the powerful combination of Kubernetes Event-Driven Autoscaler (KEDA) and Karpenter, AWS’s next-generation cluster autoscaler. You’ll begin with autoscaling fundamentals, move through HPA and VPA, and then get hands-on KEDA for event-driven workloads and Karpenter for data plane scaling. With the help of real-world use cases, best practices, and detailed patterns, you’ll deploy resilient, scalable, and cost-effective Kubernetes clusters across production environments. By the end of this book, you’ll be able to implement practical autoscaling strategies to improve performance, reduce cloud costs, and eliminate over-provisioning.

Who is this book for?

This book is ideal for DevOps engineers, SREs, cloud architects, and Kubernetes professionals who want to optimize resource usage and improve scalability. A basic understanding of Kubernetes concepts and cloud environments, i.e., AWS, GCP, and Azure, is assumed.

What you will learn

  • Gain a solid foundation in Kubernetes autoscaling and its components
  • Scale deployments, jobs, and StatefulSets using KEDA's CRDs
  • Configure event-based scaling strategies using metrics and schedules
  • Deploy and manage Karpenter for on-demand infrastructure provisioning
  • Explore advanced node disruption and lifecycle techniques
  • Combine KEDA and Karpenter to implement full-stack autoscaling
  • Optimize costs using Spot Instances, scale-to-zero, and workload placement
  • Apply real-world patterns and monitor autoscaling performance in production

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 05, 2025
Length: 420 pages
Edition : 1st
Language : English
ISBN-13 : 9781836643821
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Info icon
You can access this book only when it is published in Dec 2025
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Dec 05, 2025
Length: 420 pages
Edition : 1st
Language : English
ISBN-13 : 9781836643821
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Table of Contents

19 Chapters
Part 1: Getting started with Kubernetes Autoscaling Chevron down icon Chevron up icon
Introduction to Kubernetes Autoscaling Chevron down icon Chevron up icon
Workload Autoscaling Overview Chevron down icon Chevron up icon
Workload Autoscaling with HPA and VPA Chevron down icon Chevron up icon
Part 2: Workload Autoscaling and KEDA Chevron down icon Chevron up icon
Kubernetes Event-Driven Autoscaling – Part 1 Chevron down icon Chevron up icon
Kubernetes Event-Driven Autoscaling – Part 2 Chevron down icon Chevron up icon
Workload Autoscaling Operations Chevron down icon Chevron up icon
Part 3: Node Autoscaling and Karpenter Chevron down icon Chevron up icon
Data Plane Autoscaling Overview Chevron down icon Chevron up icon
Node Autoscaling with Karpenter — Part 1 Chevron down icon Chevron up icon
Node Autoscaling with Karpenter — Part 2 Chevron down icon Chevron up icon
Karpenter Management Operations Chevron down icon Chevron up icon
Part 4: Use Cases, Patterns, and Recommendations Chevron down icon Chevron up icon
Practical Use Cases for Autoscaling in Kubernetes Chevron down icon Chevron up icon
Patterns and Recommendations Chevron down icon Chevron up icon
Unlock Your Exclusive Benefits Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.

Modal Close icon
Modal Close icon