Skip to main content

Azure web app stop

Azure web app stop shuts down the application.

  • This fault checks if the requests have been re-routed to another instance on the application service.

Azure Web App Stop

Usage

View fault usage
This fault determines the resilience of a web application to unplanned halts (or stops). It determines the resilience based on how quickly (and efficiently) the application recovers from the failure by re-routing the traffic to a different instance on the same application service.

Prerequisites

  • Kubernetes > 1.16.
  • Adequate Azure access to stop and start the web applications.
  • Use Azure file-based authentication to connect to the instance using Azure GO SDK. To generate the auth file, run az ad sp create-for-rbac --sdk-auth > azure.auth Azure CLI command.
  • Create a Kubernetes secret that has the auth file created in the previous step in the CHAOS_NAMESPACE. Below is a sample secret file:
apiVersion: v1
kind: Secret
metadata:
name: cloud-secret
type: Opaque
stringData:
azure.auth: |-
{
"clientId": "XXXXXXXXX",
"clientSecret": "XXXXXXXXX",
"subscriptionId": "XXXXXXXXX",
"tenantId": "XXXXXXXXX",
"activeDirectoryEndpointUrl": "XXXXXXXXX",
"resourceManagerEndpointUrl": "XXXXXXXXX",
"activeDirectoryGraphResourceId": "XXXXXXXXX",
"sqlManagementEndpointUrl": "XXXXXXXXX",
"galleryEndpointUrl": "XXXXXXXXX",
"managementEndpointUrl": "XXXXXXXXX"
}
  • If you change the secret key name (from azure.auth), ensure that you update the AZURE_AUTH_LOCATION environment variable in the chaos experiment with the new name.

Default validations

Azure target web application should be in the running state.

Fault tunables

Fault tunables

Mandatory Fields

Variables Description Notes
AZURE_WEB_APP_NAMES Name of the Azure web application services to target. Comma-separated names of the web applications.
RESOURCE_GROUP The name of the resource group for the target web applications. All the web applications must belong to the same resource group.

Optional Fields

Variables Description Notes
TOTAL_CHAOS_DURATION Duration that you specify, through which chaos is injected into the target resource (in seconds). Defaults to 30s.
CHAOS_INTERVAL Time interval between two successive instance power offs. Defaults to 30s.
SEQUENCE Sequence of chaos execution for multiple instances. Defaults to parallel. Supports serial sequence as well.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30s.

Fault examples

Common fault tunables

Refer to the common attributes to tune the common tunables for all the experiments.

Stop web app by name

It contains a comma-separated list of web application names that are subject to chaos. You can tune it using the AZURE_WEB_APP_NAMES environment variable.

Use the following example to tune it:

# stop web app for a certain chaos duration 
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
chaosServiceAccount: litmus-admin
experiments:
- name: azure-web-app-stop
spec:
components:
env:
# comma-separated names of the Azure web app
- name: AZURE_WEB_APP_NAMES
value: 'webApp-01,webApp-02'
# name of the resource group
- name: RESOURCE_GROUP
value: 'chaos-rg'
- name: TOTAL_CHAOS_DURATION
VALUE: '60'