Exercise - Deploy KEDA on an Azure Kubernetes Service cluster
Enable the KEDA add-on on an AKS cluster
Use the following commands to create environment variables for the resource group name, location, and cluster name for use throughout this module:
RESOURCE_GROUP=<resource-group-name> LOCATION=<location> CLUSTER_NAME=<aks-cluster-name>Create an Azure resource group using the
az group createcommand.az group create --name $RESOURCE_GROUP --location $LOCATIONCreate an AKS cluster with the KEDA add-on enabled using the
az aks createcommand and the--enable-kedaflag.az aks create --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --enable-keda --generate-ssh-keysThis command can take a few minutes to run.
Connect to your AKS cluster using the
az aks get-credentialscommand.az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUPVerify the KEDA add-on is installed on your cluster using the
az aks showcommand and set the--queryflag toworkloadAutoScalerProfile.keda.enabled.az aks show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --query "workloadAutoScalerProfile.keda.enabled"Your output should look like the following example output, which shows the KEDA add-on is installed on the cluster:
true
Create an Azure Cache for Redis instance
Use the following command to create an environment variable for the Redis name for use throughout this module:
REDIS_NAME=contoso-redis-$RANDOMCreate an Azure Cache for Redis instance using the
az redis createcommand:az redis create --location $LOCATION --name $REDIS_NAME --resource-group $RESOURCE_GROUP --sku Basic --vm-size c0 --enable-non-ssl-portThis command can take several minutes to run.
Create environment variables for the Redis host and key for use throughout this module using the
az redis showandaz redis list-keyscommands:REDIS_HOST=$(az redis show -n $REDIS_NAME -g $RESOURCE_GROUP -o tsv --query "hostName") REDIS_KEY=$(az redis list-keys --name $REDIS_NAME --resource-group $RESOURCE_GROUP -o tsv --query "primaryKey")