39.7 KEDA on AKS: Event-Driven Scaling with Azure Services

Right, so you’ve got your AKS cluster humming along. You’ve probably set up the Horizontal Pod Autoscaler (HPA) to scale based on CPU or memory, and you’re feeling pretty good about yourself. And you should. But let’s be honest: most of the interesting stuff that happens in the cloud isn’t a slow, steady trickle of CPU load. It’s a sudden, screaming torrent of events. A million messages piling up in a Service Bus queue. A thousand new blobs dropped in a Storage account. A massive backlog in Azure Event Hubs. Your statically-provisioned pods are just sitting there, blissfully unaware of the incoming tidal wave. This is where KEDA, the Kubernetes Event-Driven Autoscaler, comes in to save the day. It’s the nervous system that connects your pod scale to the actual work that needs to be done.

39.6 AKS Add-Ons: Monitoring, Policy, and Ingress

Right, let’s talk about AKS add-ons. This is where Azure tries to save you from yourself, or at least from the sheer drudgery of wiring up the same open-source projects for the thousandth time. The idea is simple: click a checkbox (or flip a --enable-whatever flag) and Azure will install, configure, and manage a core component on your cluster for you. It’s tempting to just enable everything. Don’t. Be strategic. Some are brilliant time-savers; others… well, let’s just say you might want to bring your own.

39.5 Azure Disk and Azure Files CSI Drivers

Right, let’s talk about getting data into your pods. You’ve built this brilliant, ephemeral, self-healing microservice. Fantastic. Now it needs to read a config file. Or write a log. Or store a user’s uploaded picture of their cat. Suddenly, your perfectly stateless world needs state. This is where the Container Storage Interface (CSI) drivers come in—they’re the well-mannered bouncers that translate your pod’s polite request for storage into the specific API calls Azure understands.

39.4 Azure CNI and Kubenet Networking

Right, let’s talk networking. This is where the rubber meets the road in Kubernetes, and where Azure’s “managed” service starts to feel a lot more… hands-on. You have two primary choices here: the Azure-native kubenet and the more advanced, integrated Azure CNI. Your choice isn’t just about IP addresses; it’s a fundamental decision about how tightly you want your cluster woven into the fabric of your Azure Virtual Network (VNet). Choose poorly, and you’ll be dealing with a special kind of IP address hell. Let’s get into it.

39.3 Azure Active Directory Integration and Managed Identities

Right, let’s talk about identity. It’s the single most important and, let’s be honest, most frequently botched part of any cloud deployment. You can have the most beautifully architected app, but if it can’t talk to its database, it’s just a very expensive error message. In the old days, we’d be slinging secrets and connection strings into environment variables like we were throwing confetti. Don’t do that. It’s 2024, and we have better ways. Specifically, for your AKS cluster, we have Azure Active Directory (AAD) integration and the absolute game-changer that is Managed Identities.

39.2 Node Pools and Virtual Machine Scale Sets

Right, let’s talk about the actual workers in your AKS cluster. You’ve got your control plane managed by Azure (which is a blessing, trust me), but the nodes—the VMs where your pods actually run—are your responsibility. And in AKS, you don’t manage individual nodes; you manage node pools, which are backed by the real hero (or sometimes villain) of Azure compute: Virtual Machine Scale Sets (VMSS). Think of a node pool as a group of identical worker bees. They all have the same CPU, memory, OS, and often, the same labels and taints. You define the hive, and Azure scales the number of bees for you. Under the hood, this hive is a VMSS. It’s the Azure infrastructure service that allows you to create and manage a group of identical, load-balanced VMs. The AKS team chose VMSS because it’s the native way to get fast, reliable scaling and automated repairs. Trying to do this with individual VMs would be a nightmare they wisely decided to spare you.

39.1 AKS Cluster Creation with az CLI and Terraform

Alright, let’s get our hands dirty. You’re about to create an AKS cluster, which is essentially you renting a fully-managed Kubernetes control plane from Microsoft. The magic here is that they handle the API server, scheduler, etcd, and all those other finicky control plane components that you really don’t want to get a 3 AM page about. You just manage the worker nodes. It’s a fantastic division of labor. Now, you’ve got two primary paths to make this happen: the quick-and-dirty az cli for when you need to test something now, and the sober, responsible Terraform path for when you need something repeatable, version-controlled, and actually sane. We’ll do both. Strap in.

— joke —

...