Module file test complete
This commit is contained in:
Родитель
1c1ff39a89
Коммит
af04bb6386
|
@ -1,48 +1,72 @@
|
|||
|
||||
# Building and Scaling Azure Container Apps
|
||||
|
||||
## Azure Container Apps Features
|
||||
|
||||
* Fully managed serverless container service for building and deploying modern apps at scale.
|
||||
* Write code using your preferred programming language or framework, and build microservices with full support for [Distributed Application Runtime (DAPR)](https://dapr.io/)
|
||||
* Scale dynamically based on HTTP traffic or events powered by [Kubernetes Event-Driven Autoscaling (KEDA)](keda.sh).
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
* Completion of Module 1
|
||||
* Completion of Module 2
|
||||
* Following variables are set (from Moule 2):
|
||||
* rg_name
|
||||
* monitor_connection_string
|
||||
|
||||
## Setup
|
||||
|
||||
* install the Azure Container Apps extension for the CLI
|
||||
|
||||
```cli
|
||||
az extension add --name containerapp
|
||||
az provider register --namespace Microsoft.App
|
||||
```
|
||||
|
||||
* set the following environment variables
|
||||
|
||||
```cli
|
||||
CONTAINERAPPS_ENVIRONMENT="order"
|
||||
app_location=eastus2
|
||||
rg_name=adv-autoscaling-rg
|
||||
```
|
||||
|
||||
## Create Azure Container Apps Environment
|
||||
|
||||
```cli
|
||||
az containerapp env create \
|
||||
--name $CONTAINERAPPS_ENVIRONMENT \
|
||||
--resource-group $rg_name \
|
||||
--location $app_location
|
||||
```
|
||||
## Create a container app
|
||||
|
||||
order_processor_image='ghcr.io/kedacore/sample-dotnet-worker-servicebus-queue:latest'
|
||||
|
||||
az containerapp create \
|
||||
--image $order_processor_image \
|
||||
--name order-processor-app \
|
||||
--resource-group $rg_name \
|
||||
--environment $CONTAINERAPPS_ENVIRONMENT
|
||||
|
||||
|
||||
queue_name=orders
|
||||
servicebus_namespace=adv-autoscaling
|
||||
authorization_rule_name=order-consumer
|
||||
queue_connection_string=$(az servicebus queue authorization-rule keys list -g $rg_name --namespace-name $servicebus_namespace --queue-name $queue_name --name $authorization_rule_name --query primaryConnectionString -o tsv)
|
||||
|
||||
asb_queue_primary_key=$(az servicebus queue authorization-rule keys list -g $rg_name --namespace-name $servicebus_namespace --queue-name $asb_queue --name $asb_queue_key_name --query primaryKey -o tsv)
|
||||
|
||||
```cli
|
||||
az deployment group create --resource-group "$rg_name" \
|
||||
--template-file tools/deploy/module5/order-processor-app.json \
|
||||
--parameters \
|
||||
environment_name="$CONTAINERAPPS_ENVIRONMENT" \
|
||||
queue_connection_string="$queue_connection_string" \
|
||||
queue_connection_string="$monitor_connection_string" \
|
||||
location="$app_location"
|
||||
```
|
||||
|
||||
### Scaling on Virtual Nodes with ALT
|
||||
## Scaling Container App with Azure Load Testting (ALT)
|
||||
|
||||
* In **Module2** ALT was set up to publish messages to ASB queue to scale the demo app.
|
||||
* For this module, we just need to re-run the same test, and observe scaling of the pod on virtual nodes
|
||||
* On Azure Load Testing portal page, in `Test` menu, select the test script that was created in Module 2, and click **run**
|
||||
* At the bottom of Run Review dialog box, click **Run**
|
||||
|
||||
## Observing Scaling of Container App
|
||||
|
||||
* Wait until test status shows "Executing"
|
||||
* On Azure Portal, search of **Container Apps**
|
||||
* On **Container Apps** home page, select **Metrics** from left hand menu
|
||||
* On the new chart set up, select **CPU Usage Nanocores** under **Metric** dropdown
|
||||
* Set the time range to **Last 30 minutes**
|
||||
* on the selected chart, select "Add Filter"
|
||||
* Under the **Property** dropdown select **Replica**
|
||||
* Under the **Values**, you will see multiple replicas of **order-processor** listed
|
||||
* select one or more replicas to see their CPU usage as they consume messages inserted in the **orders** queue by ALT
|
||||
|
||||
LOG_ANALYTICS_WORKSPACE_CLIENT_ID=`az containerapp env show --name $CONTAINERAPPS_ENVIRONMENT --resource-group $rg_name --query properties.appLogsConfiguration.logAnalyticsConfiguration.customerId --out tsv`
|
||||
|
||||
az monitor log-analytics query \
|
||||
--workspace $LOG_ANALYTICS_WORKSPACE_CLIENT_ID \
|
||||
--analytics-query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == 'order-processor-app' " \
|
||||
--out table
|
|
@ -55,14 +55,18 @@
|
|||
}
|
||||
],
|
||||
"scale": {
|
||||
"minReplicas": 0,
|
||||
"minReplicas": 1,
|
||||
"maxReplicas": 10,
|
||||
"rules": [
|
||||
{
|
||||
"name": "myqueuerule",
|
||||
"azureQueue": {
|
||||
"queueName": "order",
|
||||
"queueLength": 50,
|
||||
"name": "queue-based-autoscaling",
|
||||
"custom": {
|
||||
"type": "azureServicebus",
|
||||
"metadata": {
|
||||
"queueName": "orders",
|
||||
"namespace": "adv-autoscaling",
|
||||
"messageCount": "2"
|
||||
},
|
||||
"auth": [
|
||||
{
|
||||
"secretRef": "queueconnection",
|
||||
|
|
Загрузка…
Ссылка в новой задаче