Install the Kubernetes Event-driven Autoscaling (KEDA) add-on by using Azure CLI
This article shows you how to install the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS) by using Azure CLI. The article includes steps to verify that it's installed and running.
The KEDA add-on installs version 2.7.0 of KEDA on your cluster.
- An Azure subscription. If you don't have an Azure subscription, you can create a free account.
- Azure CLI installed.
- Firewall rules are configured to allow access to the Kubernetes API server. (learn more)
Install the aks-preview Azure CLI extension
AKS preview features are available on a self-service, opt-in basis. Previews are provided "as is" and "as available," and they're excluded from the service-level agreements and limited warranty. AKS previews 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:
To install the aks-preview extension, run the following command:
az extension add --name aks-preview
Run the following command to update to the latest version of the extension released:
az extension update --name aks-preview
Register the 'AKS-KedaPreview' feature flag
AKS-KedaPreview feature flag by using the az feature register command, as shown in the following example:
az feature register --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
It takes a few minutes for the status to show Registered. Verify the registration status by using the az feature show command:
az feature show --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
When the status reflects Registered, refresh the registration of the Microsoft.ContainerService resource provider by using the az provider register command:
az provider register --namespace Microsoft.ContainerService
Install the KEDA add-on with Azure CLI
To install the KEDA add-on, use
--enable-keda when creating or updating a cluster.
The following example creates a myResourceGroup resource group. Then it creates a myAKSCluster cluster with the KEDA add-on.
az group create --name myResourceGroup --location eastus az aks create \ --resource-group myResourceGroup \ --name myAKSCluster \ --enable-keda
For existing clusters, use
az aks update with
--enable-keda option. The following code shows an example.
az aks update \ --resource-group myResourceGroup \ --name myAKSCluster \ --enable-keda
Get the credentials for your cluster
Get the credentials for your AKS cluster by using the
az aks get-credentials command. The following example command gets the credentials for myAKSCluster in the myResourceGroup resource group:
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
Verify that the KEDA add-on is installed on your cluster
To see if the KEDA add-on is installed on your cluster, verify that the
enabled value is
The following example shows the status of the KEDA add-on for myAKSCluster in myResourceGroup:
az aks show -g "myResourceGroup" --name myAKSCluster --query "workloadAutoScalerProfile.keda.enabled"
Verify that KEDA is running on your cluster
You can verify KEDA that's running on your cluster. Use
kubectl to display the operator and metrics server installed in the AKS cluster under kube-system namespace. For example:
kubectl get pods -n kube-system
The following example output shows that the KEDA operator and metrics API server are installed in the AKS cluster along with its status.
kubectl get pods -n kube-system keda-operator-********-k5rfv 1/1 Running 0 43m keda-operator-metrics-apiserver-*******-sj857 1/1 Running 0 43m
To verify the version of your KEDA, use
kubectl get crd/scaledobjects.keda.sh -o yaml . For example:
kubectl get crd/scaledobjects.keda.sh -o yaml
The following example output shows the configuration of KEDA in the
kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: "2022-06-08T10:31:06Z" generation: 1 labels: addonmanager.kubernetes.io/mode: Reconcile app.kubernetes.io/component: operator app.kubernetes.io/name: keda-operator app.kubernetes.io/part-of: keda-operator app.kubernetes.io/version: 2.7.0 name: scaledobjects.keda.sh resourceVersion: "2899" uid: 85b8dec7-c3da-4059-8031-5954dc888a0b spec: conversion: strategy: None group: keda.sh names: kind: ScaledObject listKind: ScaledObjectList plural: scaledobjects shortNames: - so singular: scaledobject scope: Namespaced # Redacted for simplicity
While KEDA provides various customization options, the KEDA add-on currently provides basic common configuration.
If you have requirement to run with another custom configurations, such as namespaces that should be watched or tweaking the log level, then you may edit the KEDA YAML manually and deploy it.
However, when the installation is customized there will no support offered for custom configurations.
Disable KEDA add-on from your AKS cluster
When you no longer need KEDA add-on in the cluster, use the
az aks update command with--disable-keda option. This execution will disable KEDA workload auto-scaler.
az aks update \ --resource-group myResourceGroup \ --name myAKSCluster \ --disable-keda
This article showed you how to install the KEDA add-on on an AKS cluster using Azure CLI. The steps to verify that KEDA add-on is installed and running are included. With the KEDA add-on installed on your cluster, you can deploy a sample application to start scaling apps.
You can troubleshoot KEDA add-on problems in this article.