Skip to content

Commit e8338a6

Browse files
Merge pull request #252904 from schaffererin/kedadeployaddonarm
Freshness and editing pass: Deploy KEDA add-on with ARM template
2 parents 094e1b5 + c6563fc commit e8338a6

File tree

1 file changed

+90
-119
lines changed

1 file changed

+90
-119
lines changed
Lines changed: 90 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,148 @@
11
---
2-
title: Install the Kubernetes Event-driven Autoscaling (KEDA) add-on by using an ARM template
2+
title: Install the Kubernetes Event-driven Autoscaling (KEDA) add-on using an ARM template
33
description: Use an ARM template to deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS).
44
author: jahabibi
55
ms.topic: article
66
ms.custom: devx-track-azurecli, devx-track-arm-template
7-
ms.date: 10/10/2022
7+
ms.date: 09/26/2023
88
ms.author: jahabibi
99
---
1010

11-
# Install the Kubernetes Event-driven Autoscaling (KEDA) add-on by using ARM template
11+
# Install the Kubernetes Event-driven Autoscaling (KEDA) add-on using an ARM template
1212

13-
This article shows you how to deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS) by using an [ARM](../azure-resource-manager/templates/index.yml) template.
13+
This article shows you how to deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS) using an [ARM template](../azure-resource-manager/templates/index.yml).
1414

1515
[!INCLUDE [Current version callout](./includes/keda/current-version-callout.md)]
1616

17-
## Prerequisites
17+
## Before you begin
1818

19-
- An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
20-
- [Azure CLI installed](/cli/azure/install-azure-cli).
21-
- Firewall rules are configured to allow access to the Kubernetes API server. ([learn more][aks-firewall-requirements])
19+
- You need an Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
20+
- You need the [Azure CLI installed](/cli/azure/install-azure-cli).
21+
- This article assumes you have an existing Azure resource group. If you don't have an existing resource group, you can create one using the [`az group create`][az-group-create] command.
22+
- Ensure you have firewall rules configured to allow access to the Kubernetes API server. For more information, see [Outbound network and FQDN rules for Azure Kubernetes Service (AKS) clusters][aks-firewall-requirements].
23+
- [Install the `aks-preview` Azure CLI extension](#install-the-aks-preview-azure-cli-extension).
24+
- [Register the `AKS-KedaPreview` feature flag](#register-the-aks-kedapreview-feature-flag).
25+
- [Create an SSH key pair](#create-an-ssh-key-pair).
2226

23-
## Install the aks-preview Azure CLI extension
27+
### Install the `aks-preview` Azure CLI extension
2428

2529
[!INCLUDE [preview features callout](includes/preview/preview-callout.md)]
2630

27-
To install the aks-preview extension, run the following command:
31+
1. Install the `aks-preview` extension using the [`az extension add`][az-extension-add] command.
2832

29-
```azurecli
30-
az extension add --name aks-preview
31-
```
33+
```azurecli-interactive
34+
az extension add --name aks-preview
35+
```
3236
33-
Run the following command to update to the latest version of the extension released:
37+
2. Update to the latest version of the `aks-preview` extension using the [`az extension update`][az-extension-update] command.
3438
35-
```azurecli
36-
az extension update --name aks-preview
37-
```
39+
```azurecli-interactive
40+
az extension update --name aks-preview
41+
```
3842
39-
## Register the 'AKS-KedaPreview' feature flag
43+
### Register the `AKS-KedaPreview` feature flag
4044
41-
Register the `AKS-KedaPreview` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example:
45+
1. Register the `AKS-KedaPreview` feature flag using the [`az feature register`][az-feature-register] command.
4246
43-
```azurecli-interactive
44-
az feature register --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
45-
```
47+
```azurecli-interactive
48+
az feature register --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
49+
```
4650
47-
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [az feature show][az-feature-show] command:
51+
It takes a few minutes for the status to show *Registered*.
4852
49-
```azurecli-interactive
50-
az feature show --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
51-
```
53+
2. Verify the registration status using the [`az feature show`][az-feature-show] command.
5254
53-
When the status reflects *Registered*, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [az provider register][az-provider-register] command:
55+
```azurecli-interactive
56+
az feature show --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
57+
```
5458
55-
```azurecli-interactive
56-
az provider register --namespace Microsoft.ContainerService
57-
```
59+
3. When the status reflects *Registered*, refresh the registration of the *Microsoft.ContainerService* resource provider using the [`az provider register`][az-provider-register] command.
5860
59-
## Install the KEDA add-on with Azure Resource Manager (ARM) templates
61+
```azurecli-interactive
62+
az provider register --namespace Microsoft.ContainerService
63+
```
6064
61-
The KEDA add-on can be enabled by deploying an AKS cluster with an Azure Resource Manager template and specifying the `workloadAutoScalerProfile` field:
65+
### Create an SSH key pair
6266
63-
```json
64-
"workloadAutoScalerProfile": {
65-
"keda": {
66-
"enabled": true
67-
}
68-
}
69-
```
67+
1. Navigate to the [Azure Cloud Shell](https://shell.azure.com/).
68+
2. Create an SSH key pair using the [`az sshkey create`][az-sshkey-create] command.
7069
71-
## Connect to your AKS cluster
70+
```azurecli-interactive
71+
az sshkey create --name <sshkey-name> --resource-group <resource-group-name>
72+
```
73+
74+
## Enable the KEDA add-on with an ARM template
75+
76+
1. Deploy the [ARM template for an AKS cluster](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.kubernetes%2Faks%2Fazuredeploy.json).
77+
2. Select **Edit template**.
78+
3. Enable the KEDA add-on by specifying the `workloadAutoScalerProfile` field in the ARM template, as shown in the following example:
7279
73-
To connect to the Kubernetes cluster from your local computer, you use [kubectl][kubectl], the Kubernetes command-line client.
74-
75-
If you use the Azure Cloud Shell, `kubectl` is already installed. You can also install it locally using the [az aks install-cli][] command:
76-
77-
```azurecli
78-
az aks install-cli
79-
```
80-
81-
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*:
82-
83-
```azurecli
84-
az aks get-credentials --resource-group MyResourceGroup --name MyAKSCluster
85-
```
86-
87-
## Example deployment
88-
89-
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.
90-
91-
```json
92-
{
93-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
94-
"contentVersion": "1.0.0.0",
95-
"resources": [
96-
{
97-
"apiVersion": "2022-05-02-preview",
98-
"dependsOn": [],
99-
"type": "Microsoft.ContainerService/managedClusters",
100-
"location": "westcentralus",
101-
"name": "myAKSCluster",
102-
"properties": {
103-
"kubernetesVersion": "1.23.5",
104-
"enableRBAC": true,
105-
"dnsPrefix": "myAKSCluster",
106-
"agentPoolProfiles": [
107-
{
108-
"name": "agentpool",
109-
"osDiskSizeGB": 200,
110-
"count": 3,
111-
"enableAutoScaling": false,
112-
"vmSize": "Standard_D2S_v5",
113-
"osType": "Linux",
114-
"storageProfile": "ManagedDisks",
115-
"type": "VirtualMachineScaleSets",
116-
"mode": "System",
117-
"maxPods": 110,
118-
"availabilityZones": [],
119-
"nodeTaints": [],
120-
"enableNodePublicIP": false
121-
}
122-
],
123-
"networkProfile": {
124-
"loadBalancerSku": "standard",
125-
"networkPlugin": "kubenet"
126-
},
127-
"workloadAutoScalerProfile": {
128-
"keda": {
129-
"enabled": true
130-
}
131-
}
132-
},
133-
"identity": {
134-
"type": "SystemAssigned"
80+
```json
81+
"workloadAutoScalerProfile": {
82+
"keda": {
83+
"enabled": true
13584
}
13685
}
137-
]
138-
}
139-
```
86+
```
14087
141-
## Start scaling apps with KEDA
88+
4. Select **Save**.
89+
5. Update the required values for the ARM template:
90+
91+
- **Subscription**: Select the Azure subscription to use for the deployment.
92+
- **Resource group**: Select the resource group to use for the deployment.
93+
- **Region**: Select the region to use for the deployment.
94+
- **Dns Prefix**: Enter a unique DNS name to use for the cluster.
95+
- **Linux Admin Username**: Enter a username for the cluster.
96+
- **SSH public key source**: Select **Use existing key stored in Azure**.
97+
- **Store Keys**: Select the key pair you created earlier in the article.
98+
99+
6. Select **Review + create** > **Create**.
142100
143-
Now that KEDA is installed, you can start autoscaling your apps with KEDA by using its custom resource definition has been defined (CRD).
101+
## Connect to your AKS cluster
102+
103+
To connect to the Kubernetes cluster from your local device, you use [kubectl][kubectl], the Kubernetes command-line client.
104+
105+
If you use the Azure Cloud Shell, `kubectl` is already installed. You can also install it locally using the [`az aks install-cli`][az-aks-install-cli] command.
106+
107+
- Configure `kubectl` to connect to your Kubernetes cluster using the [`az aks get-credentials`][az-aks-get-credentials] command.
108+
109+
```azurecli-interactive
110+
az aks get-credentials --resource-group <resource-group-name> --name <cluster-name>
111+
```
112+
113+
## Start scaling apps with KEDA
144114
145-
To learn more about KEDA CRDs, follow the official [KEDA documentation][keda-scalers] to define your scaler.
115+
You can autoscale your apps with KEDA using custom resource definitions (CRDs). For more information, see the [KEDA documentation][keda-scalers].
146116
147-
## Clean Up
117+
## Remove resources
148118
149-
To remove the resource group, and all related resources, use the [Az PowerShell module group delete][az-group-delete] command:
119+
- Remove the resource group and all related resources using the [`az group delete`][az-group-delete] command.
150120
151-
```azurecli
152-
az group delete --name MyResourceGroup
153-
```
121+
```azurecli-interactive
122+
az group delete --name <resource-group-name>
123+
```
154124
155125
## Next steps
156126
157127
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][keda-sample] to start scaling apps.
158128
159-
You can troubleshoot KEDA add-on problems in [this article][keda-troubleshoot].
129+
For information on KEDA troubleshooting, see [Troubleshoot the Kubernetes Event-driven Autoscaling (KEDA) add-on][keda-troubleshoot].
160130
161131
<!-- LINKS - internal -->
162-
[az-aks-create]: /cli/azure/aks#az-aks-create
163-
[az aks install-cli]: /cli/azure/aks#az-aks-install-cli
164-
[az aks get-credentials]: /cli/azure/aks#az-aks-get-credentials
165-
[az aks update]: /cli/azure/aks#az-aks-update
166132
[az-group-delete]: /cli/azure/group#az-group-delete
167133
[keda-troubleshoot]: /troubleshoot/azure/azure-kubernetes/troubleshoot-kubernetes-event-driven-autoscaling-add-on?context=/azure/aks/context/aks-context
168134
[aks-firewall-requirements]: outbound-rules-control-egress.md#azure-global-required-network-rules
169135
[az-provider-register]: /cli/azure/provider#az-provider-register
170136
[az-feature-register]: /cli/azure/feature#az-feature-register
171137
[az-feature-show]: /cli/azure/feature#az-feature-show
138+
[az-sshkey-create]: /cli/azure/ssh#az-sshkey-create
139+
[az-aks-get-credentials]: /cli/azure/aks#az-aks-get-credentials
140+
[az-aks-install-cli]: /cli/azure/aks#az-aks-install-cli
141+
[az-extension-add]: /cli/azure/extension#az-extension-add
142+
[az-extension-update]: /cli/azure/extension#az-extension-update
143+
[az-group-create]: /cli/azure/group#az-group-create
172144
173145
<!-- LINKS - external -->
174146
[kubectl]: https://kubernetes.io/docs/reference/kubectl/
175-
[keda]: https://keda.sh/
176147
[keda-scalers]: https://keda.sh/docs/scalers/
177148
[keda-sample]: https://github.com/kedacore/sample-dotnet-worker-servicebus-queue

0 commit comments

Comments
 (0)