⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All AWS & Cloud Architecture Interview Questions Scenario 171 of 186 in AWS & Cloud Architecture
Senior DevOps / SRE Azure & Cloud AKS Autoscaling & Serverless Autoscaling Architecture

Q: Your message processing microservice on AKS consumes orders from Azure Service Bus. During flash sales, 500,000 messages flood the queue in 2 minutes. Standard Horizontal Pod Autoscaler (HPA) based on CPU/memory scales too slowly, causing huge message processing lag. How do you implement KEDA with Azure Service Bus and Cluster Autoscaler to scale pods from 0 to 300 instances dynamically?

Engineering a responsive event-driven autoscaling pipeline on AKS using Kubernetes Event-driven Autoscaling (KEDA) triggered by Azure Service Bus queue depths and synchronized with Cluster Autoscaler.

#Azure #AKS #KEDA #Cluster Autoscaler #Service Bus #Event-Driven
🎙️ Candidate Opening & Architectural Context
"Standard Kubernetes HPA relies on resource metrics (CPU/RAM). When an event surge arrives, CPU doesn't spike until pods begin processing messages, leading to severe queue backlog. We deployed KEDA to scale pods directly on external queue length."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? Stephane Maarek's AWS Certified DevOps Engineer Professional Masterclass on Udemy covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

1️⃣

Enable KEDA Add-on on Azure Kubernetes Service

Activate the managed KEDA controller directly via Azure CLI:

  • Enable Add-on: Executed az aks update --resource-group rg-aks --name aks-prod --enable-keda.
  • Verify KEDA Operator: Confirmed keda-operator and keda-metrics-apiserver pods are running in the kube-system namespace.
Pro Tip: The managed KEDA add-on is maintained and patched by Microsoft, eliminating manual Helm release management.
2️⃣

Configure KEDA TriggerAuthentication with Azure Workload Identity

Securely authenticate KEDA against Azure Service Bus without storing connection strings:

  • TriggerAuthentication CRD: Created TriggerAuthentication referencing pod Workload Identity with identityId: $MANAGED_IDENTITY_CLIENT_ID.
  • Azure RBAC: Granted the Managed Identity Azure Service Bus Data Receiver and Azure Service Bus Data Owner roles on the Service Bus namespace.
Pro Tip: Authenticating KEDA via Workload Identity avoids embedding fragile SAS shared access keys in Kubernetes secrets.
3️⃣

Deploy KEDA ScaledObject with Scaled Metric Targets

Define the scaling rules binding the deployment to queue message depth:

  • ScaledObject Manifest: Applied ScaledObject targeting order-processor deployment with minReplicaCount: 0, maxReplicaCount: 300, and cooldownPeriod: 300.
  • Trigger Spec: Configured azure-servicebus trigger with queueName: orders and messageCount: 50 (spawning 1 pod for every 50 pending messages).
Pro Tip: Scaling to zero (minReplicaCount: 0) completely frees compute resources when the queue is empty, saving substantial off-peak compute costs.
4️⃣

Tune AKS Cluster Autoscaler for Rapid Scale-Out

Prevent pod scheduling bottlenecks when hundreds of pods are created simultaneously:

  • Autoscaler Profile: Configured cluster autoscaler profile: az aks update -g rg-aks -n aks-prod --cluster-autoscaler-profile scan-interval=10s,scale-down-delay-after-add=10m,scale-down-unneeded-time=5m.
  • Overprovisioning Buffer: Deployed a low-priority pause pod deployment to reserve spare node capacity, ensuring immediate scheduling of incoming worker pods while new nodes boot.
Pro Tip: Combining KEDA with low-priority pause pod overprovisioning eliminates VM spin-up wait times during unexpected traffic surges.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"KEDA transforms AKS into an event-driven platform by scaling pods based on external queue lengths (scale to zero and scale to hundreds), while Cluster Autoscaler elastically provisions underlying VM capacity."
⚡ 60-Second Elevator Pitch Talking Points
  • Enable the managed KEDA add-on on AKS via Azure CLI.
  • Authenticate KEDA securely against Azure Service Bus using Azure AD Workload Identity.
  • Deploy ScaledObject CRDs to scale pods from 0 to 300 based on exact message queue depth.
  • Tune Cluster Autoscaler scan intervals and deploy pause pod overprovisioning for instant pod scheduling.
Advertisement
Want more AWS & Cloud Architecture scenarios?
Explore our complete collection of scenario-based AWS & Cloud Architecture interview runbooks.
Browse All AWS & Cloud Architecture Questions →