title | description | services | author | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|
Deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on by using an ARM template |
Use an ARM template to deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS). |
container-service |
jahabibi |
article |
05/24/2022 |
jahabibi |
This article shows you how to deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS) by using an ARM template.
[!INCLUDE Current version callout]
[!INCLUDE preview features callout]
Note
KEDA is currently only available in the westcentralus
region.
- An Azure subscription. If you don't have an Azure subscription, you can create a free account.
- Azure CLI installed.
To use the KEDA, you must enable the AKS-KedaPreview
feature flag on your subscription.
az feature register --name AKS-KedaPreview --namespace Microsoft.ContainerService
You can check on the registration status by using the az feature list
command:
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/AKS-KedaPreview')].{Name:name,State:properties.state}"
When ready, refresh the registration of the Microsoft.ContainerService resource provider by using the az provider register
command:
az provider register --namespace Microsoft.ContainerService
The KEDA add-on can be enabled by deploying an AKS cluster with an Azure Resource Manager template and specifying the workloadAutoScalerProfile
field:
"workloadAutoScalerProfile": {
"keda": {
"enabled": true
}
}
To connect to the Kubernetes cluster from your local computer, you use kubectl, the Kubernetes command-line client.
If you use the Azure Cloud Shell, kubectl
is already installed. You can also install it locally using the az aks install-cli command:
az aks install-cli
To configure kubectl
to connect to your Kubernetes cluster, use the az aks get-credentials command. The following example gets credentials for the AKS cluster named MyAKSCluster in the MyResourceGroup:
az aks get-credentials --resource-group MyResourceGroup --name MyAKSCluster
The following snippet is a sample deployment that creates a cluster with KEDA enabled with a single node pool comprised of three DS2_v5
nodes.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2022-05-02-preview",
"dependsOn": [],
"type": "Microsoft.ContainerService/managedClusters",
"location": "westcentralus",
"name": "myAKSCluster",
"properties": {
"kubernetesVersion": "1.23.5",
"enableRBAC": true,
"dnsPrefix": "myAKSCluster",
"agentPoolProfiles": [
{
"name": "agentpool",
"osDiskSizeGB": 200,
"count": 3,
"enableAutoScaling": false,
"vmSize": "Standard_D2S_v5",
"osType": "Linux",
"storageProfile": "ManagedDisks",
"type": "VirtualMachineScaleSets",
"mode": "System",
"maxPods": 110,
"availabilityZones": [],
"nodeTaints": [],
"enableNodePublicIP": false
}
],
"networkProfile": {
"loadBalancerSku": "standard",
"networkPlugin": "kubenet"
},
"workloadAutoScalerProfile": {
"keda": {
"enabled": true
}
}
},
"identity": {
"type": "SystemAssigned"
}
}
]
}
Now that KEDA is installed, you can start autoscaling your apps with KEDA by using its custom resource definition has been defined (CRD).
To learn more about KEDA CRDs, follow the official KEDA documentation to define your scaler.
To remove the resource group, and all related resources, use the az group delete command:
az group delete --name MyResourceGroup
This article showed you how to install the KEDA add-on on an AKS cluster, and then verify that it's installed and running. With the KEDA add-on installed on your cluster, you can deploy a sample application to start scaling apps