You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Integrate KEDA with your Azure Kubernetes Service cluster
2
2
3
-
KEDA is a Kubernetes-based Event Driven Autoscaler. KEDA lets you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed, by querying metrics from systems such as Prometheus. Integrate KEDA with your Azure Kubernetes Service (AKS) cluster to scale your workloads based on Prometheus metrics from your Azure Monitor workspace.
3
+
KEDA is a Kubernetes-based Event Driven Autoscaler. KEDA lets you can drive the scaling of any container in Kubernetes based on the load to be processed, by querying metrics from systems such as Prometheus. Integrate KEDA with your Azure Kubernetes Service (AKS) cluster to scale your workloads based on Prometheus metrics from your Azure Monitor workspace.
4
4
5
-
To integrate KEDA into your Azure Kubernetes Service, you need to deploy and configure a workload identity or pod identity on your cluster. This allows KEDA to authenticate with Azure and retrieve metrics for scaling from your Monitor workspace.
5
+
To integrate KEDA into your Azure Kubernetes Service, you have to deploy and configure a workload identity or pod identity on your cluster. The identity allows KEDA to authenticate with Azure and retrieve metrics for scaling from your Monitor workspace.
6
6
7
-
This article will walk you through the steps to integrate KEDA into your AKS cluster using a workload identity.
7
+
This article walks you through the steps to integrate KEDA into your AKS cluster using a workload identity.
8
8
9
9
## Prerequisites
10
10
@@ -19,143 +19,142 @@ This article will walk you through the steps to integrate KEDA into your AKS clu
19
19
20
20
1. Start by setting up some environment variables. Change the values to suit your AKS cluster.
21
21
22
-
Don't change the values for `SERVICE_ACCOUNT_NAMESPACE` and `SERVICE_ACCOUNT_NAME`. They are the namespace and name of the kubernetes service account that KEDA will use to authenticate with Azure Monitor.
23
-
24
-
`USER_ASSIGNED_IDENTITY_NAME` is the name of the Azure Active directory identity that will be created for KEDA.
25
-
`FEDERATED_IDENTITY_CREDENTIAL_NAME` is the name of the credential that will be created for KEDA to use to authenticate with Azure.
26
-
27
-
```bash
28
-
export RESOURCE_GROUP="rg-keda-integration"
29
-
export LOCATION="eastus"
30
-
export SUBSCRIPTION="$(az account show --query id --output tsv)"
1. If your AKS cluster has not been created with workload-identity or oidc-issuer enabled, you will need to enable it. If you are not sure, you can run the following command to check if it is enabled.
38
-
39
-
```azurecli
40
-
az aks show --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query oidcIssuerProfile
41
-
az aks show --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query securityProfile.workloadIdentity
42
-
```
43
-
44
-
To enable workload identity and oidc-issuer , run the following command.
45
-
46
-
```azurecli
47
-
az aks update -g $RESOURCE_GROUP -n $AKS_CLUSTER_NAME --enable-managed-identity --enable-oidc-issuer
48
-
```
49
-
50
-
1. Store the OIDC issuer url in an environment variable. This will be used later.
51
-
52
-
```bash
53
-
export AKS_OIDC_ISSUER="$(az aks show -n $CLUSTER_NAME -g $RESOURCE_GROUP --query "oidcIssuerProfile.issuerUrl" -otsv)"
54
-
```
22
+
Don't change the values for `SERVICE_ACCOUNT_NAMESPACE` and `SERVICE_ACCOUNT_NAME`. They're the namespace and name of the kubernetes service account that KEDA uses to authenticate with Azure.
23
+
24
+
`USER_ASSIGNED_IDENTITY_NAME` is the name of the Azure Active directory identity that's created for KEDA.
25
+
`FEDERATED_IDENTITY_CREDENTIAL_NAME` is the name of the credential that's created for KEDA to use to authenticate with Azure.
26
+
27
+
```bash
28
+
export RESOURCE_GROUP="rg-keda-integration"
29
+
export LOCATION="eastus"
30
+
export SUBSCRIPTION="$(az account show --query id --output tsv)"
1. If your AKS cluster hasn't been created with workload-identity or oidc-issuer enabled, you'll need to enable it. If you aren't sure, you can run the following command to check if it's enabled.
38
+
39
+
```azurecli
40
+
az aks show --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query oidcIssuerProfile
41
+
az aks show --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query securityProfile.workloadIdentity
42
+
```
43
+
44
+
To enable workload identity and oidc-issuer, run the following command.
45
+
46
+
```azurecli
47
+
az aks update -g $RESOURCE_GROUP -n $AKS_CLUSTER_NAME --enable-managed-identity --enable-oidc-issuer
48
+
```
49
+
50
+
1. Store the OIDC issuer url in an environment variable to be used later.
51
+
52
+
```bash
53
+
export AKS_OIDC_ISSUER="$(az aks show -n $CLUSTER_NAME -g $RESOURCE_GROUP --query "oidcIssuerProfile.issuerUrl" -otsv)"
54
+
```
55
+
56
+
1. Create a user assigned identity for KEDA. This identity is used by KEDA to authenticate with Azure Monitor.
1. Assign the *Monitoring Data Reader* role user to identity for your Azure Monitor workspace. This will allow KEDA to read metrics from you workspace.
1. Assign the *Monitoring Data Reader* role to the identity for your Azure Monitor workspace. This role allows the identity to read metrics from your workspace.
kubectl describe serviceaccount workload-identity-sa -n keda
115
-
```
115
+
```bash
116
+
kubectl describe serviceaccount workload-identity-sa -n keda
117
+
```
116
118
117
-
1. Establish the federated identity between the service account and the user assigned identity. This will allow the service account to use the user assigned identity to authenticate with Azure.
1. Establish a federated credential between the service account and the user assigned identity. The federated credential allows the service account to use the user assigned identity to authenticate with Azure.
KEDA can be deployed using YAML manifests or Helm charts. This article will use Helm charts. For more information on deploying KEDA, see [Deploying KEDA](https://keda.sh/docs/2.10/deploy/)
127
+
KEDA can be deployed using YAML manifests or Helm charts. This article uses Helm charts. For more information on deploying KEDA, see [Deploying KEDA](https://keda.sh/docs/2.10/deploy/)
127
128
128
129
1. Deply KEDA using the following command.
129
130
130
131
131
-
```bash
132
-
helm install keda kedacore/keda --namespace keda \
Scalers define how and when KEDA should scale a deployment. KEDA supports a variety of scalers. For more information on scalers, see [Scalers](https://keda.sh/docs/2.10/scalers/prometheus/)
154
155
155
156
The following yaml file defines a scaler.
156
157
157
-
The `serverAddress` is the Query endpoint of your Azure Monitor workspace. `metricName` is the name of the metric you want to scale on. The `query` is the query used to retrieve the metric. The `threshold` is the value at which the deployment will scale. Set thee `podIdentity.provider` according to the type of identity you are using.
158
-
159
158
```yml
160
159
apiVersion: keda.sh/v1alpha1
161
160
kind: TriggerAuthentication
@@ -186,17 +185,23 @@ spec:
186
185
authenticationRef:
187
186
name: azure-managed-prometheus-trigger-auth
188
187
```
188
+
+ `serverAddress` is the Query endpoint of your Azure Monitor workspace.
189
+
+ `metricName` is the name of the metric you want to scale on.
190
+
+ `query` is the query used to retrieve the metric.
191
+
+ `threshold` is the value at which the deployment scales.
192
+
+ Set the `podIdentity.provider` according to the type of identity you're using.
189
193
190
194
## Troubleshooting
191
195
196
+
The following section provides troubleshooting tips for common issues.
192
197
193
198
### Federated credentials
194
199
195
-
Federated credentials can take up to 10 minutes to propagate. If you are having issues with KEDA authenticating with Azure, try the following steps.
200
+
Federated credentials can take up to 10 minutes to propagate. If you're having issues with KEDA authenticating with Azure, try the following steps.
196
201
197
202
The following log excerpt shows an error with the federated credentials.
198
203
199
-
```bash
204
+
```
200
205
kubectl logs -n keda keda-operator-5d9f7d975-mgv7r
Check the values used to create the ServiceAccount and the credentials created with `az identity federated-credential create` and ensure the `subject` value matches the `system:serviceaccount` value.
216
221
217
-
### Azure Monitor workspace persmissions
222
+
### Azure Monitor workspace permissions
218
223
219
-
If you are having issues with KEDA authenticating with Azure, check the permissions for the Azure Monitor workspace.
220
-
The following log excerpt shows that the identity does not have read permissions for the Azure Monitor workspace.
224
+
If you're having issues with KEDA authenticating with Azure, check the permissions for the Azure Monitor workspace.
225
+
The following log excerpt shows that the identity doesn't have read permissions for the Azure Monitor workspace.
221
226
222
-
```bash
227
+
```
223
228
kubectl logs -n keda keda-operator-5d9f7d975-mgv7r
224
229
225
230
2023-05-30T11:15:45Z ERROR scale_handler error getting metric for scaler
0 commit comments