- عنوان کتاب: Kubernetes Autoscaling -Build efficient, cost-optimized clusters with KEDA and Karpenter
- نویسنده: Christian Melendez
- حوزه: DevOps
- سال انتشار: 2025
- تعداد صفحه: 421
- زبان اصلی: انگلیسی
- نوع فایل: pdf
- حجم فایل: 13.7 مگابایت
اگر مدتی است که بارهای کاری Kubernetes را اجرا میکنید، احتمالاً آن لحظه را داشتهاید که به صورتحساب ابری خود خیره شدهاید و از خود میپرسید که چگونه میتوانید دهها گرهای را که در نهایت به آنها نیاز دارید، بهینه کنید. یا بدتر از آن، نیمهشب به شما پیام داده شده است زیرا کلاستر شما نتوانسته است یک افزایش ترافیک را مدیریت کند و کاربران خطا دریافت میکنند. مقیاسبندی خودکار قرار است هر دو مشکل را حل کند، اما صادقانه بگویم، بین پیکربندیهای HPA، VPA و Karpenter، همه چیز میتواند خیلی سریع پیچیده شود. در طول این کتاب، استراتژیهای عملی مقیاسبندی خودکار را بررسی خواهید کرد که فراتر از اصول اولیه مقیاسبندی بر اساس استفاده از CPU یا حافظه هستند. یاد خواهید گرفت که چگونه بر اساس آنچه بر عملکرد برنامههای شما تأثیر میگذارد و آنچه کاربران شما واقعاً به آن اهمیت میدهند، مقیاسبندی کنید. این موضوع با رشد بارهای کاری AI/ML که در Kubernetes اجرا میشوند، اهمیت بیشتری پیدا میکند. معمولاً، این موضوع مربوط به استفاده از CPU یا حافظه نیست و با KEDA میتوانید فراتر از این دو معیار عمل کنید. علاوه بر این، شما با رویکرد کارپنتر در زمینه تأمین کارآمد گره، بهینهسازی گره و مدیریت اختلال آشنا خواهید شد. مهمتر از آن، یاد خواهید گرفت که چگونه KEDA و کارپنتر با هم همکاری میکنند تا یک استراتژی مقیاسپذیری خودکار ایجاد کنند که باعث صرفهجویی در هزینه و کاهش ضایعات میشود. مقیاسپذیری خودکار Kubernetes فقط در مورد مدیریت افزایش ناگهانی ترافیک نیست. مقیاسپذیری خودکار کارآمد به این معنی است که زیرساخت شما با تقاضای واقعی مطابقت دارد، در صورت امکان به صفر میرسد و دقیقاً آنچه را که هنگام افزایش بار نیاز دارید، تأمین میکند. به نوعی، ما در نجات سیاره زمین، هر بار یک پاد، مشارکت خواهیم کرد. مثالها و الگوهای موجود در این کتاب از سناریوهای تولید واقعی گرفته شدهاند. من موارد حاشیهای، مواردی که خراب میشوند و نظارتی را که برای اعتماد به تنظیمات مقیاسپذیری خودکار خود نیاز دارید، پوشش خواهم داد. شما راهنماییهای عملی برای پاسخگوتر کردن خوشههای خود و معقولتر کردن هزینههای ابری خود خواهید یافت. من این کتاب را نوشتم زیرا مقیاسپذیری خودکار در Kubernetes به طور قابل توجهی فراتر از اصول اولیه تکامل یافته است، اما اکثر ما هنوز به همان الگوهایی که سالها پیش آموختهایم، تکیه میکنیم. میخواهم شما برای ساخت کلاسترهای کارآمد Kubernetes با یک استراتژی مقیاسپذیری خودکار مؤثر، احساس آمادگی و اعتماد به نفس داشته باشید. KEDA و Karpenter نشاندهنده یک تغییر اساسی در نحوه تفکر ما در مورد مقیاسپذیری هستند، نه فقط واکنش به معیارهای CPU یا حافظه، بلکه پاسخ به رویدادهایی که برای حجم کاری شما مهم هستند و تأمین زیرساخت در عرض چند ثانیه به جای چند دقیقه. کتابهای شگفتانگیز زیادی در حال حاضر موضوعات مختلفی در مورد Kubernetes را پوشش میدهند، اما این کتاب بر جنبه کارایی و بهینهسازی هزینه یک کلاستر تمرکز دارد. بنابراین، فرض میکنم شما از قبل دانش اولیهای در مورد Kubernetes دارید و با استفاده از یک ترمینال برای تعامل با یک کلاستر احساس راحتی میکنید. در حالی که میتوانید به سادگی کتاب را در طول رفت و آمد خود بخوانید، ارزش واقعی سفر یادگیری شما در انجام آزمایشگاههای عملی این کتاب خواهد بود. من متوجه شدهام که با انجام دادن، بیشتر از خواندن صرف، یاد میگیرم. در واقع، اگر هرگونه گواهینامه Kubernetes را گذرانده باشید، میدانید که داشتن تجربه عملی مهمتر از دانستن فقط تئوری است. فصل 1، مقدمهای بر مقیاسپذیری خودکار Kubernetes، اصول اولیهای را که باید در مورد مقیاسپذیری خودکار به طور کلی بدانید، و نحوه اعمال همه این مفاهیم در اکوسیستم Kubernetes را پوشش میدهد. شما در مورد اجزا، مفاهیم و نظریهای که هنگام بررسی سایر فصلها ضروری خواهد بود، خواهید آموخت. علاوه بر این، اولین آزمایشگاه عملی شما در مورد راهاندازی خوشه Kubernetes شما خواهد بود. فصل 2، مروری بر مقیاسپذیری خودکار بار کاری، با پرداختن به اصول اولیه نحوه رویکرد به مقیاسپذیری خودکار بار کاری در Kubernetes و اهمیت پیکربندی درخواستهای منابع pod آغاز میشود. شما با تمرین بررسی خواهید کرد که چرا نظارت بر استفاده از بار کاری برای اندازه گیری صحیح podها برای بهبود کارایی و هزینه خوشه شما مهم است. در نهایت، شروع به یادگیری در مورد ابزارها و پروژههای مختلفی خواهید کرد که به شما کمک میکنند تا بارهای کاری خود را به صورت افقی مقیاسبندی خودکار کنید. فصل 3، مقیاسپذیری خودکار بار کاری با HPA و VPA، سادهترین روش مقیاسپذیری خودکار بار کاری خود را به صورت افقی با استفاده از HPA و نحوه آمادهسازی خوشه خود برای استفاده از HPA پوشش میدهد. شما یاد خواهید گرفت که چگونه قوانین مقیاسبندی را با CPU و حافظه پیکربندی کنید، زیرا این به عنوان پایهای برای بررسی عمیقتر KEDA در آینده عمل خواهد کرد. علاوه بر این، خواهید فهمید که چگونه از معیارهای سفارشی برای مقیاسبندی استفاده کنید و چرا KEDA اهمیت بیشتری پیدا میکند. در نهایت، در مورد VPA و زمان استفاده از آن، به ویژه به عنوان ابزاری برای اندازهگیری صحیح، خواهید آموخت. فصل 4، مقیاسبندی خودکار مبتنی بر رویداد Kubernetes – بخش 1، شروع به پیکربندی مقیاسبندی خودکار بار کاری فراتر از اصول اولیه میکند. شما در مورد عملکرد داخلی KEDA و اینکه چرا بسیاری از تیمها از آن برای مقیاسبندی هوشمندانهتر بارهای کاری خود استفاده میکنند، خواهید آموخت. آزمایشگاههای عملی به شما کمک میکنند تا پیکربندی قوانین مقیاسبندی را با استفاده از تأخیر به جای استفاده از CPU شروع کنید. علاوه بر این، در مورد ویژگیهای معروف KEDA، مانند مقیاسبندی به (و از) صفر، کنترل سرعت مقیاسبندی خودکار و نحوه مقیاسبندی کارهای Kubernetes، خواهید آموخت. فصل 5، مقیاسبندی خودکار مبتنی بر رویداد Kubernetes – بخش 2، به ویژگیهای پیشرفتهتر (و نه چندان معروف) KEDA میپردازد….
If you’ve been running Kubernetes workloads for a while, you’ve probably had that moment where you’re staring at your cloud bill, wondering how you can optimize the dozens of nodes you end up needing at some point. Or worse, you’ve been paged at midnight because your cluster couldn’t handle a traffic spike, and users are getting errors. Autoscaling is supposed to solve both problems, but to be honest, between HPA, VPA, and Karpenter configurations, things can get complicated very fast. Throughout this book, you’ll explore practical autoscaling strategies that go beyond the basics of scaling based on CPU or memory utilization. You’ll learn how to scale based on what influences the performance of your applications, and what your users really care about. This is becoming even more relevant with the growth of AI/ML workloads running in Kubernetes. Usually, it’s not about CPU or memory utilization, and with KEDA, you can go beyond these two metrics. Moreover, you’ll dive into Karpenter’s approach to efficient node provisioning, node optimizations, and disruption management. More importantly, you’ll learn how KEDA and Karpenter work together to create an autoscaling strategy that saves money and reduces waste. Kubernetes autoscaling isn’t just about handling traffic spikes. Efficient autoscaling means your infrastructure matches actual demand, scaling to zero when possible and provisioning exactly what you need when load increases. In a way, we’ll be contributing to saving the planet one pod at a time. The examples and patterns in this book come from real production scenarios. I’ll cover the edge cases, the things that break, and the monitoring you need to trust your autoscaling setup. You’ll find practical guidance for making your clusters more responsive and your cloud bills more reasonable. I wrote this book because autoscaling in Kubernetes has evolved significantly beyond the basics, but most of us are still relying on the same patterns we learned years ago. I want you to feel prepared and confident to build efficient Kubernetes clusters with an effective autoscaling strategy. KEDA and Karpenter represent a fundamental shift in how we think about scaling, not just reacting to CPU or memory metrics, but responding to the events that matter for your workloads, and provisioning infrastructure in seconds rather than minutes. There are many amazing books already covering different topics about Kubernetes, but this book focuses on the efficiency and cost-optimization aspect of a cluster. Thus, I’ll assume you already have basic knowledge of Kubernetes and feel comfortable using a terminal to interact with a cluster. While you can simply read the book during your commute, the real value of your learning journey is going to be in doing the hands-on labs in this book. I’ve found that I learn more by doing than just reading. In fact, if you’ve gone through any Kubernetes certification, you know that it’s more important to have hands-on experience than to know only theory. Chapter 1, Introduction to Kubernetes Autoscaling, covers the basics you need to know about autoscaling in general, and how all these concepts apply to the Kubernetes ecosystem. You’ll learn about the components, concepts, and theory that will be essential when exploring the other chapters. Moreover, your first hands-on lab will be about setting up your Kubernetes cluster. Chapter 2, Workload Autoscaling Overview, starts by addressing the fundamentals of how to approach autoscaling your workloads in Kubernetes, and the importance of configuring pod resource requests. You’ll explore by practicing why monitoring your workload utilization is important to properly right-size your pods to improve your cluster’s efficiency and cost. Finally, you’ll start learning about the different tools and projects that will help you autoscale your workloads horizontally. Chapter 3, Workload Autoscaling with HPA and VPA, covers the simplest way of autoscaling your workloads horizontally using HPA, and how to prepare your cluster to use HPA. You’ll learn how to configure scaling rules, with CPU and memory, as this will serve as the foundation to later dive deeper into KEDA. Moreover, you’ll understand how to use custom metrics to scale and why KEDA becomes even more relevant. Finally, you’ll learn about VPA and when to use it, especially as a tool for rightsizing. Chapter 4, Kubernetes Event-Driven Autoscaling – Part 1, starts to configure workload autoscaling beyond the basics. You’ll learn about the inner workings of KEDA and why many teams are using it to scale their workloads smarter. The hands-on labs will help to get started configuring scaling rules using latency instead of CPU utilization. Moreover, you’ll learn about KEDA’s famous features, such as scaling to (and from) zero, controlling autoscaling speed, and how to scale Kubernetes jobs. Chapter 5, Kubernetes Event-Driven Autoscaling – Part 2, dives into more advanced (and not so famous) features of KEDA. For instance, you’ll learn about how to configure scaling rules based on schedule, scaling HTTP-based workloads from (and to) zero, scaling modifiers for complex scaling rules, and how to use KEDA with cloud providers. Chapter 6, Workload Autoscaling Operations, focuses on all the operational work of using HPA, VPA, and KEDA in your cluster. You’ll learn how to troubleshoot your autoscaling rules, along with some recommendations about how to solve common problems. Finally, you’ll learn how to monitor KEDA’s autoscaling rules by using Grafana, and why some metrics are crucial for understanding why KEDA might not be scaling your workloads in the way you intended. Chapter 7, Data Plane Autoscaling Overview, changes gears to start exploring how to autoscale the nodes in your cluster. You’ll understand why you need different projects, such as Cluster Autoscaler and Karpenter, and what specific problem they’re addressing in the ecosystem. As the following chapters will focus on Karpenter, during this chapter, you’ll dive deep into Cluster Autoscaler setup and best practices (especially around AWS). Finally, you’ll explore complementary projects such as Descheduler and Cluster Proportional Autoscaler, and learn why the book will only briefly mention them. Chapter 8, Node Autoscaling with Karpenter – Part 1, covers Karpenter in more depth, including its history and how it works. Unlike traditional guides and tutorials you can currently find on the internet, this chapter will dive deep into how and when Karpenter launches new nodes, and the considerations it takes when doing so. You’ll learn how to deploy Karpenter through infrastructure as code using Terraform, and see Karpenter in action for the first time. Finally, you’ll learn how to influence Karpenter to launch nodes using pods’ constraints such as node selectors, affinities, anti-affinities, tolerations, and recommendations based on your workload needs. Chapter 9, Node Autoscaling with Karpenter – Part 2, continues exploring Karpenter, but from the perspective of removing nodes. You’ll learn how Karpenter removes nodes and all the considerations it takes to make this process as controlled and clean as possible. Moreover, you’ll explore the different types of disruptions Karpenter handles either through consolidation to optimize the cluster further, or because the node’s configuration drifted. You’ll also learn about the Node- Pool disruption budgets to limit voluntary disruptions. Finally, I’ll share a set of practical best practices for Karpenter. Chapter 10, Karpenter Management Operations, covers the management operation side of having Karpenter running in the cluster. You’ll learn about the tools, commands, and techniques you can use to troubleshoot and understand why Karpenter might not be scaling your nodes the way you intended. Moreover, the chapter focuses on common challenges you might face and how to properly address them. You’ll learn how to properly upgrade Karpenter with very specific guidance. Finally, you’ll learn how to monitor Karpenter with Grafana, and why certain metrics exposed by the controller are crucial to monitor. Chapter 11, Practical Use Cases for Autoscaling in Kubernetes, focuses on the practical integration with KEDA and Karpenter, with common use cases such as web applications, batch jobs, and GPU workloads, and how to cost-optimize your cluster when using these two projects. For each use case, you’ll learn the best practices; the purpose is to guide you on how to implement these recommendations in your environment. Chapter 12, Patterns and Recommendations, teaches you about two very common use cases when combining KEDA and Karpenter. The first one is about how to properly turn off non-production environments when you’re not using them. Then, you’ll learn about the set of recommendations you need to implement to work with fault-tolerant workloads. And if your workloads are not there yet, the purpose is that you understand what’s required to get there, and why this is relevant in the autoscaling ecosystem. As a final chapter, you’ll reflect on what to consider when configuring autoscaling rules and the future trends in the ecosystem, especially around KEDA and Karpenter.
این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:
Download: Kubernetes Autoscaling

نظرات کاربران