Welcome to the Azure Kubernetes Service (AKS) Resource Management and Autoscaling Lab! This comprehensive lab will guide you through essential techniques for managing resources, implementing autoscaling, and ensuring application resilience in Kubernetes.
This lab is available in two versions:
| Version | Description | Path |
|---|---|---|
| Bash | Original labs using Bash/Linux shell syntax | Root chapter folders |
| PowerShell | Labs converted to PowerShell syntax | ./psversion/ folder |
PowerShell users: Use the links in the PowerShell Version column below, or navigate directly to the
psversionfolder.
By completing this lab, you will gain hands-on experience with:
- Resource Management: Configure resource requests and limits for optimal pod scheduling and resource utilization
- Resource Governance: Implement LimitRange and ResourceQuota to enforce resource policies at namespace level
- Horizontal Autoscaling: Configure Horizontal Pod Autoscaler (HPA) to automatically scale applications based on metrics
- Event-Driven Autoscaling: Deploy KEDA to scale applications based on external events and custom metrics
- Application Resilience: Implement Pod Disruption Budgets (PDB) to maintain availability during cluster maintenance
This lab is organized into the following chapters:
| Chapter | Topic | Bash Version | PowerShell Version |
|---|---|---|---|
| 0 | Setup and Prerequisites | Bash | PowerShell |
| 1 | Resource Requests and Limits | Bash | PowerShell |
| 2 | LimitRange and ResourceQuota | Bash | PowerShell |
| 3 | Horizontal Pod Autoscaler (HPA) | Bash | PowerShell |
| 4 | KEDA - Event-Driven Autoscaling | Bash | PowerShell |
| 5 | Pod Disruption Budgets | Bash | PowerShell |
-
Chapter 0: Setup and Prerequisites
- Setting your student initials
- Creating resource group and AKS cluster
- Installing required tools and add-ons
-
Chapter 1: Resource Requests and Limits
- Understanding resource requests vs limits
- Configuring CPU and memory resources
- Observing QoS classes (Guaranteed, Burstable, BestEffort)
- Testing resource enforcement and OOM scenarios
-
Chapter 2: LimitRange and ResourceQuota
- Implementing default resource limits with LimitRange
- Setting namespace-level constraints with ResourceQuota
- Testing quota enforcement and resource tracking
- Managing multi-tenant cluster resources
-
Chapter 3: Horizontal Pod Autoscaler (HPA)
- Deploying metrics-server for resource metrics
- Configuring HPA based on CPU and memory
- Load testing and observing scale-up/scale-down behavior
- Understanding HPA cooldown periods and thresholds
-
Chapter 4: KEDA - Event-Driven Autoscaling
- Installing KEDA in AKS
- Scaling based on Azure Service Bus queue length
- Scaling based on HTTP requests (KEDA HTTP Add-on)
- Configuring scale-to-zero scenarios
- Comparing KEDA with standard HPA
-
Chapter 5: Pod Disruption Budgets
- Understanding voluntary vs involuntary disruptions
- Configuring minAvailable and maxUnavailable constraints
- Testing PDB during node drains
- Balancing availability with cluster maintenance
- PDB best practices for different workload types
- Total Lab Duration: 2-3 hours
- Chapter 0 (Setup): 15-20 minutes
- Chapter 1 (Requests & Limits): 20-25 minutes
- Chapter 2 (LimitRange & Quota): 20-25 minutes
- Chapter 3 (HPA): 25-30 minutes
- Chapter 4 (KEDA): 30-35 minutes
- Chapter 5 (PDB): 15-20 minutes
- Azure subscription with appropriate permissions
- Basic knowledge of Kubernetes concepts (pods, deployments, services)
- Familiarity with Azure CLI and kubectl
- Understanding of basic resource concepts (CPU, memory)
- Text editor (VS Code recommended)
- Start with Chapter 0: Setup and Prerequisites
- Complete each chapter in sequence
- Keep your AKS cluster running throughout the lab
- Each chapter builds on previous concepts
- Set your initials: You'll use student initials for resource naming to avoid conflicts
- One cluster for all: Use the same AKS cluster throughout all chapters
- Monitor resources: Use
kubectl top nodesandkubectl top podsto observe resource usage - Load generation: Several chapters include load generation - ensure load generators complete
- Save your work: Keep track of resource names and configurations
- Ask for help: Don't hesitate to ask your instructor if you get stuck
- All students in the same subscription should use unique initials for naming
- Some resources may take several minutes to provision
- HPA and KEDA may take 1-2 minutes to react to load changes
- Keep your Azure CLI session active throughout the lab
- Save important commands and outputs for reference
After completing all chapters, refer to the cleanup section in Chapter 0 to remove all resources and avoid unnecessary charges.
Ready to begin? Head over to Chapter 0: Setup and Prerequisites to get started!