Skip to content

Commit 6f8483a

Browse files
authored
Merge pull request #201168 from raorugan/rolocalbranch
az cli docs changes to private repo - azure-docs-pr
2 parents f0e23e3 + 95f53af commit 6f8483a

File tree

3 files changed

+222
-9
lines changed

3 files changed

+222
-9
lines changed

articles/aks/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@
473473
href: keda-about.md
474474
- name: Use ARM template
475475
href: keda-deploy-add-on-arm.md
476+
- name: Use Azure CLI
477+
href: keda-deploy-add-on-cli.md
476478
- name: Kubernetes Event-driven Autoscaler (KEDA) integrations
477479
href: keda-integrations.md
478480
- name: Use Web Application Routing (preview)

articles/aks/keda-deploy-add-on-arm.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on by using an ARM template
2+
title: Install the Kubernetes Event-driven Autoscaling (KEDA) add-on by 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
services: container-service
55
author: jahabibi
@@ -8,7 +8,7 @@ ms.date: 05/24/2022
88
ms.author: jahabibi
99
---
1010

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

1313
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.
1414

@@ -18,9 +18,6 @@ This article shows you how to deploy the Kubernetes Event-driven Autoscaling (KE
1818

1919
## Prerequisites
2020

21-
> [!NOTE]
22-
> KEDA is currently only available in the `westcentralus` region.
23-
2421
- An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
2522
- [Azure CLI installed](/cli/azure/install-azure-cli).
2623

@@ -44,7 +41,7 @@ When ready, refresh the registration of the *Microsoft.ContainerService* resourc
4441
az provider register --namespace Microsoft.ContainerService
4542
```
4643

47-
## Deploy the KEDA add-on with Azure Resource Manager (ARM) templates
44+
## Install the KEDA add-on with Azure Resource Manager (ARM) templates
4845

4946
The KEDA add-on can be enabled by deploying an AKS cluster with an Azure Resource Manager template and specifying the `workloadAutoScalerProfile` field:
5047

@@ -60,13 +57,13 @@ The KEDA add-on can be enabled by deploying an AKS cluster with an Azure Resourc
6057

6158
To connect to the Kubernetes cluster from your local computer, you use [kubectl][kubectl], the Kubernetes command-line client.
6259

63-
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:
60+
If you use the Azure Cloud Shell, `kubectl` is already installed. You can also install it locally using the [az aks install-cli][] command:
6461

6562
```azurecli
6663
az aks install-cli
6764
```
6865

69-
To configure `kubectl` to connect to your Kubernetes cluster, use the [az aks get-credentials][az aks get-credentials] command. The following example gets credentials for the AKS cluster named *MyAKSCluster* in the *MyResourceGroup*:
66+
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*:
7067

7168
```azurecli
7269
az aks get-credentials --resource-group MyResourceGroup --name MyAKSCluster
@@ -134,11 +131,30 @@ To learn more about KEDA CRDs, follow the official [KEDA documentation][keda-sca
134131

135132
## Clean Up
136133

137-
To remove the resource group, and all related resources, use the [az group delete][az-group-delete] command:
134+
To remove the resource group, and all related resources, use the [Az PowerShell module group delete][az-group-delete] command:
138135

139136
```azurecli
140137
az group delete --name MyResourceGroup
141138
```
139+
140+
### Enabling add-on on clusters with self-managed open-source KEDA installations
141+
142+
While Kubernetes only allows one metric server to be installed, you can in theory install KEDA multiple times. However, it isn't recommended given only one installation will work.
143+
144+
When the KEDA add-on is installed in an AKS cluster, the previous installation of open-source KEDA will be overridden and the add-on will take over.
145+
146+
This means that the customization and configuration of the self-installed KEDA deployment will get lost and no longer be applied.
147+
148+
While there's a possibility that the existing autoscaling will keep on working, there's a risk given it will be configured differently and won't support features such as managed identity.
149+
150+
It's recommended to uninstall existing KEDA installations before enabling the KEDA add-on given the installation will succeed without any error.
151+
152+
Following error will be thrown in the operator logs but the installation of KEDA add-on will be completed.
153+
154+
Error logged in now-suppressed non-participating KEDA operator pod:
155+
the error logged inside the already installed KEDA operator logs.
156+
E0520 11:51:24.868081 1 leaderelection.go:330] error retrieving resource lock default/operator.keda.sh: config maps "operator.keda.sh" is forbidden: User "system:serviceaccount:default:keda-operator" can't get resource "config maps" in API group "" in the namespace "default"
157+
142158
## Next steps
143159

144160
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
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
---
2+
title: Install the Kubernetes Event-driven Autoscaling (KEDA) add-on by using Azure CLI
3+
description: Use Azure CLI to deploy the Kubernetes Event-driven Autoscaling (KEDA) add-on to Azure Kubernetes Service (AKS).
4+
author: raorugan
5+
ms.author: raorugan
6+
ms.service: container-service
7+
ms.topic: article
8+
ms.date: 06/08/2022
9+
ms.custom: template-how-to
10+
---
11+
12+
# Install the Kubernetes Event-driven Autoscaling (KEDA) add-on by using Azure CLI
13+
14+
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.
15+
16+
[!INCLUDE [Current version callout](./includes/keda/current-version-callout.md)]
17+
18+
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
19+
20+
## Prerequisites
21+
22+
- An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
23+
- [Azure CLI installed](/cli/azure/install-azure-cli).
24+
25+
### Install the extension `aks-preview`
26+
27+
Install the `aks-preview` extension in the AKS cluster to make sure you have the latest version of AKS extension before installing KEDA add-on.
28+
29+
```azurecli
30+
- az extension add --upgrade --name aks-preview
31+
```
32+
33+
### Register the `AKS-KedaPreview` feature flag
34+
35+
To use the KEDA, you must enable the `AKS-KedaPreview` feature flag on your subscription.
36+
37+
```azurecli
38+
az feature register --name AKS-KedaPreview --namespace Microsoft.ContainerService
39+
```
40+
41+
You can check on the registration status by using the `az feature list` command:
42+
43+
```azurecli-interactive
44+
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/AKS-KedaPreview')].{Name:name,State:properties.state}"
45+
```
46+
47+
When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the `az provider register` command:
48+
49+
```azurecli-interactive
50+
az provider register --namespace Microsoft.ContainerService
51+
```
52+
53+
## Install the KEDA add-on with Azure CLI
54+
To install the KEDA add-on, use `--enable-keda` when creating or updating a cluster.
55+
56+
The following example creates a *myResourceGroup* resource group. Then it creates a *myAKSCluster* cluster with the KEDA add-on.
57+
58+
```azurecli-interactive
59+
az group create --name myResourceGroup --location eastus
60+
61+
az aks create \
62+
--resource-group myResourceGroup \
63+
--name myAKSCluster \
64+
--enable-keda
65+
```
66+
67+
For existing clusters, use `az aks update` with `--enable-keda` option. The following code shows an example.
68+
69+
```azurecli-interactive
70+
az aks update \
71+
--resource-group myResourceGroup \
72+
--name myAKSCluster \
73+
--enable-keda
74+
```
75+
76+
## Get the credentials for your cluster
77+
78+
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:
79+
80+
```azurecli-interactive
81+
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
82+
```
83+
84+
## Verify that the KEDA add-on is installed on your cluster
85+
86+
To see if the KEDA add-on is installed on your cluster, verify that the `enabled` value is `true` for `keda` under `workloadAutoScalerProfile`.
87+
88+
The following example shows the status of the KEDA add-on for *myAKSCluster* in *myResourceGroup*:
89+
90+
```azurecli-interactive
91+
az aks show -g "myResourceGroup" --name myAKSCluster --query "workloadAutoScalerProfile.keda.enabled"
92+
```
93+
## Verify that KEDA is running on your cluster
94+
95+
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:
96+
97+
```azurecli-interactive
98+
kubectl get pods -n kube-system
99+
```
100+
101+
The following example output shows that the KEDA operator and metrics API server are installed in the AKS cluster along with its status.
102+
103+
```output
104+
kubectl get pods -n kube-system
105+
106+
keda-operator-********-k5rfv 1/1 Running 0 43m
107+
keda-operator-metrics-apiserver-*******-sj857 1/1 Running 0 43m
108+
```
109+
To verify the version of your KEDA, use `kubectl get crd/scaledobjects.keda.sh -o yaml `. For example:
110+
111+
```azurecli-interactive
112+
kubectl get crd/scaledobjects.keda.sh -o yaml
113+
```
114+
The following example output shows the configuration of KEDA in the `app.kubernetes.io/version` label:
115+
116+
```yaml
117+
kind: CustomResourceDefinition
118+
metadata:
119+
annotations:
120+
controller-gen.kubebuilder.io/version: v0.8.0
121+
creationTimestamp: "2022-06-08T10:31:06Z"
122+
generation: 1
123+
labels:
124+
addonmanager.kubernetes.io/mode: Reconcile
125+
app.kubernetes.io/component: operator
126+
app.kubernetes.io/name: keda-operator
127+
app.kubernetes.io/part-of: keda-operator
128+
app.kubernetes.io/version: 2.7.0
129+
name: scaledobjects.keda.sh
130+
resourceVersion: "2899"
131+
uid: 85b8dec7-c3da-4059-8031-5954dc888a0b
132+
spec:
133+
conversion:
134+
strategy: None
135+
group: keda.sh
136+
names:
137+
kind: ScaledObject
138+
listKind: ScaledObjectList
139+
plural: scaledobjects
140+
shortNames:
141+
- so
142+
singular: scaledobject
143+
scope: Namespaced
144+
# Redacted for simplicity
145+
```
146+
147+
While KEDA provides various customization options, the KEDA add-on currently provides basic common configuration.
148+
149+
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.
150+
151+
However, when the installation is customized there will no support offered for custom configurations.
152+
153+
## Disable KEDA add-on from your AKS cluster
154+
155+
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.
156+
157+
```azurecli-interactive
158+
az aks update \
159+
--resource-group myResourceGroup \
160+
--name myAKSCluster \
161+
--disable-keda
162+
```
163+
164+
### Enabling add-on on clusters with self-managed open-source KEDA installations
165+
166+
While Kubernetes only allows one metric server to be installed, you can in theory install KEDA multiple times. However, it isn't recommended given only one installation will work.
167+
168+
When the KEDA add-on is installed in an AKS cluster, the previous installation of open-source KEDA will be overridden and the add-on will take over.
169+
170+
This means that the customization and configuration of the self-installed KEDA deployment will get lost and no longer be applied.
171+
172+
While there's a possibility that the existing autoscaling will keep on working, there's a risk given it will be configured differently and won't support features such as managed identity.
173+
174+
It's recommended to uninstall existing KEDA installations before enabling the KEDA add-on given the installation will succeed without any error.
175+
176+
Following error will be thrown in the operator logs but the installation of KEDA add-on will be completed.
177+
178+
Error logged in now-suppressed non-participating KEDA operator pod:
179+
the error logged inside the already installed KEDA operator logs.
180+
E0520 11:51:24.868081 1 leaderelection.go:330] error retrieving resource lock default/operator.keda.sh: config maps "operator.keda.sh" is forbidden: User "system:serviceaccount:default:keda-operator" can't get resource "config maps" in API group "" in the namespace "default"
181+
182+
## Next steps
183+
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][keda-sample] to start scaling apps.
184+
185+
[az-aks-create]: /cli/azure/aks#az-aks-create
186+
[az aks install-cli]: /cli/azure/aks#az-aks-install-cli
187+
[az aks get-credentials]: /cli/azure/aks#az-aks-get-credentials
188+
[az aks update]: /cli/azure/aks#az-aks-update
189+
[az-group-delete]: /cli/azure/group#az-group-delete
190+
191+
[kubectl]: https://kubernetes.io/docs/user-guide/kubectl
192+
[keda]: https://keda.sh/
193+
[keda-scalers]: https://keda.sh/docs/scalers/
194+
[keda-sample]: https://github.com/kedacore/sample-dotnet-worker-servicebus-queue
195+

0 commit comments

Comments
 (0)