Skip to main content

Azure instance stop

Azure instance stop powers off from an Azure instance for a specific duration. It checks the performance of the application or process running on the instance.

Azure Instance Stop

Use cases

Azure instance stop:

  • Determines the resilience of an application to unexpected power off of the Azure instances.
  • Determines how the application handles the requests and how quickly it recovers from such failures.

Prerequisites

  • Kubernetes >= 1.17
  • Appropriate Azure access to start and stop an instance.
  • Azure instance should be in a healthy state.
  • Use Azure file-based authentication to connect to the instance using Azure GO SDK in the experiment. To generate the auth file, run az ad sp create-for-rbac --sdk-auth > azure.auth Azure CLI command.
  • Kubernetes secret should contain 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"
}
tip

If you change the secret key name from azure.auth to a new name, ensure that you update the AZURE_AUTH_LOCATION environment variable in the chaos experiment with the new name. AZURE_AUTH_LOCATION is variable that describes path to the authetication file which uses the default value in most cases.

Mandatory tunables

Tunable Description Notes
AZURE_INSTANCE_NAMES Name of the target Azure instance. For AKS nodes, the instance name is from the Scale Set in Azure and not the node name from AKS node pool. For more information, go to stop instance by name.
RESOURCE_GROUP The name of the resource group for the target instance. For example, TeamDevops. For more information, go to resource group field in the YAML file.

Optional tunables

Tunable Description Notes
SCALE_SET Whether instance is part of Scale set Accepts "enable"/"disable". Default is "disable" For more information, go to scale set instances.
TOTAL_CHAOS_DURATION Duration that you specify, through which chaos is injected into the target resource (in seconds). Defaults to 30s. For more information, go to duration of the chaos.
CHAOS_INTERVAL Time interval between two successive instance power offs (in seconds). Defaults to 30s. For more information, go to chaos interval.
DEFAULT_HEALTH_CHECK Determines if you wish to run the default health check which is present inside the fault. Default: 'true'. For more information, go to default health check.
SEQUENCE Sequence of chaos execution for multiple target instances. Defaults to parallel. Also supports serial sequence. For more information, go to sequence of chaos execution.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30s. For more information, go to ramp time.

Stop instances by name

It specifies a comma-separated list of instance names subject to chaos. Tune it by using the AZURE_INSTANCE_NAME environment variable.

You can use the following example to tune it:

## contains the Azure instance details
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: azure-instance-stop
spec:
components:
env:
# comma separated list of Azure instance names
- name: AZURE_INSTANCE_NAMES
value: 'instance-01,instance-02'
# name of the resource group
- name: RESOURCE_GROUP
value: 'rg-azure'

Stop scale set instances

It specifies a comma-separated list of instance names that belong to Scale Set or AKS which are subject to chaos. Tune it by using the SCALE_SET environment variable.

You can use the following example to tune it:

## contains the Azure instance details for scale set instances or AKS nodes
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: azure-instance-stop
spec:
components:
env:
# comma separated list of Azure instance names
- name: AZURE_INSTANCE_NAMES
value: 'instance-01,instance-02'
# name of the resource group
- name: RESOURCE_GROUP
value: 'rg-azure'
# accepts enable/disable value. default is disable
- name: SCALE_SET
value: 'enable'