Azure disk loss
Azure disk loss detaches the virtual disk from an Azure instance.
- After a specific duration, the virtual disk is re-attached to the instance.
- This fault checks the performance of the application (or process) running on the instance.
Use cases
Azure disk loss:
- Determines the resilience of an application to unexpected disk detachment.
- Determines how quickly the Azure instance recovers from such failures.
note
- Kubernetes > 1.16 is required to execute this fault.
- Appropriate Azure access to detach and attach a disk.
- Azure disk should be connected to an instance.
- Use Azure file-based authentication to connect to the instance using Azure GO SDK. To generate 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"
}
- If you change the secret key name from
azure.auth
to a new name, ensure that you update theAZURE_AUTH_LOCATION
environment variable in the chaos experiment with the new name.
Fault tunables
Mandatory fields
Variables | Description | Notes |
---|---|---|
VIRTUAL_DISK_NAMES | Name of the virtual disks to target. | Provide comma-separated names for multiple disks. For more information, go to detach virtual disks by name. |
RESOURCE_GROUP | Name of the resource group for the target disk(s). | For example, TeamDevops . For more information, go to resource group field in the YAML file. |
Optional fields
Variables | Description | Notes |
---|---|---|
SCALE_SET | Checks if the disk is connected to scale set instance. | Defaults to disable. Also supports enable . 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 poweroffs (in seconds). | Defaults to 30s. For more information, go to chaos interval. |
SEQUENCE | Sequence of chaos execution for multiple target pods. | 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. |
Detach virtual disks by name
It specifies a comma-separated list of disk names that are subject to disk loss. Tune it by using the VIRTUAL_DISK_NAMES
environment variable.
Use the following example to tune it:
# detach multiple Azure disks by their names
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: azure-disk-loss
spec:
components:
env:
# comma separated names of the Azure disks attached to VMs
- name: VIRTUAL_DISK_NAMES
value: 'disk-01,disk-02'
# name of the resource group
- name: RESOURCE_GROUP
value: 'rg-azure-disks'
Detach virtual disks attached to scale set instances by name
It specifies a comma-separated list of disk names attached to Scale Set instances subject to disk loss. Tune it by using the VIRTUAL_DISK_NAMES
and SCALE_SET
environment variables, respectively.
Use the following example to tune it:
# detach multiple Azure disks attached to scale set VMs by their names
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: azure-disk-loss
spec:
components:
env:
# comma separated names of the Azure disks attached to scaleset VMs
- name: VIRTUAL_DISK_NAMES
value: 'disk-01,disk-02'
# name of the resource group
- name: RESOURCE_GROUP
value: 'rg-azure-disks'
# VM belongs to scaleset or not
- name: SCALE_SET
value: 'enable'