Edit

Simplified application autoscaling with Kubernetes Event-driven Autoscaling (KEDA) add-on in Azure Kubernetes Service (AKS)

Important

The KEDA add-on for AKS doesn't currently support modifying the CPU requests or limits and other Helm values for the Metrics Server or Operator. Keep this limitation in mind when using the add-on. If you have any questions, feel free to reach out here.

Kubernetes Event-driven Autoscaling (KEDA) is a single-purpose and lightweight component that makes application autoscaling simple. It's a Cloud Native Computing Foundation (CNCF) Graduate project. KEDA uses event-driven autoscaling to scale your application to meet demand in a sustainable and cost-efficient manner with scale-to-zero.

For most production workloads, AKS Automatic is the recommended default AKS experience. AKS Automatic is production ready by default and includes KEDA preconfigured on the cluster. If you use AKS Standard, you can enable KEDA by using the managed KEDA add-on.

To learn more about AKS Automatic, see What is Azure Kubernetes Service (AKS) Automatic?

Note

KEDA version 2.15+ introduces a breaking change that removes pod identity support. We recommend moving over to workload identity for your authentication if you're using pod identity. While the KEDA managed add-on doesn't currently run KEDA version 2.15+, the managed add-on will begin running KEDA 2.15+ in AKS preview version 1.32.

For more information on how to securely scale your applications with workload identity, read our tutorial. To view KEDA's breaking change/deprecation policy, read their official documentation.

KEDA in AKS Automatic and AKS Standard

KEDA is available in both AKS cluster modes, but the setup path is different:

  • AKS Automatic: KEDA is preconfigured and ready to use.
  • AKS Standard: Enable KEDA by turning on the AKS managed add-on.

For most production scenarios, start with AKS Automatic to use production-ready defaults and reduce cluster management overhead.

Architecture

KEDA provides two main components:

  • KEDA operator allows end-users to scale workloads in or out from 0 to N instances with support for Kubernetes Deployments, Jobs, StatefulSets, or any custom resource that defines /scale subresource.
  • Metrics server exposes external metrics to Horizontal Pod Autoscaler (HPA) in Kubernetes for autoscaling purposes such as messages in a Kafka topic, or number of events in an Azure event hub. Due to upstream limitations, KEDA must be the only installed external metric adapter.

Diagram that shows the architecture of KEDA and how it extends Kubernetes.

Learn more about how KEDA works in the official KEDA documentation.

Installation and enablement

AKS Automatic

KEDA is preconfigured in AKS Automatic. No separate KEDA add-on installation step is required.

AKS Standard

Enable KEDA on AKS Standard by using one of the following methods:

The managed KEDA add-on provides a fully supported KEDA installation integrated with AKS.

Capabilities and features

KEDA provides the following capabilities and features:

  • Scale workloads to zero when demand drops.
  • Scale application workloads to meet demand using Azure KEDA scalers.
  • Autoscale applications by using ScaledObjects, such as Deployments, StatefulSets, or any custom resource that defines the /scale subresource.
  • Autoscale job-like workloads by using ScaledJobs.
  • Use production-grade security by decoupling autoscaling authentication from workloads.
  • Bring your own external scaler for custom autoscaling logic.
  • Integrate with Microsoft Entra Workload ID for authentication.

In AKS Automatic, you get these event-driven autoscaling capabilities by default because the cluster is preconfigured with KEDA.

Note

If you plan to use workload identity on AKS Standard, enable workload identity before enabling the KEDA add-on.

Production guidance

Use this guidance to choose your cluster mode:

  • Choose AKS Automatic when you want a production-ready default experience with KEDA preconfigured.
  • Choose AKS Standard when you need deeper cluster-level customization and explicit add-on management.
  • Use KEDA in either mode for event-driven autoscaling workloads.

Add-on limitations

The KEDA AKS add-on has the following limitations:

  • KEDA's HTTP add-on (preview) to scale HTTP workloads isn't installed with the extension, but can be deployed separately.
  • KEDA's external scaler for Azure Cosmos DB to scale based on Azure Cosmos DB change feed isn't installed with the extension, but can be deployed separately.
  • Only one external metric server is allowed in the Kubernetes cluster. Because of that the KEDA add-on should be the only external metrics server inside the cluster.
    • Multiple KEDA installations aren't supported
  • It's not recommended to combine KEDA's ScaledObject with a Horizontal Pod Autoscaler (HPA) to scale the same workload. They compete with each other because KEDA uses Horizontal Pod Autoscaler (HPA) in the background and results in odd scaling behavior.
    • If an HPA is created first, then a KEDA ScaledObject is created and the KEDA ScaledObject would fail to be created.
    • If a KEDA ScaledObject is created first and then an HPA is created, the HPA creation isn't blocked.

For general KEDA questions, we recommend visiting the FAQ overview.

Note

If you're using Microsoft Entra Workload ID and you enable KEDA before Workload ID, you need to restart the KEDA operator pods so the proper environment variables can be injected:

  1. Restart the pods by running kubectl rollout restart deployment keda-operator -n kube-system.

  2. Obtain KEDA operator pods using kubectl get pod -n kube-system and finding pods that begin with keda-operator.

  3. Verify successful injection of the environment variables by running kubectl describe pod <keda-operator-pod> -n kube-system. Under Environment, you should see values for AZURE_TENANT_ID, AZURE_FEDERATED_TOKEN_FILE, and AZURE_AUTHORITY_HOST.

Supported Kubernetes and KEDA versions

Your cluster Kubernetes version determines which KEDA version is installed on your AKS cluster. To see which KEDA version maps to each AKS version, see the AKS managed add-ons column of the Kubernetes component version table.

For GA Kubernetes versions, AKS offers full support of the corresponding KEDA minor version in the table. Kubernetes preview versions and the latest KEDA patch are partially covered by customer support on a best-effort basis. As such, these features aren't meant for production use. For more information, see the following support articles: