Skip to main content

VMware VM power off

VMware VM poweroff stops (or powers off) the VMware VMs for a specific duration.

  • After the duration, the VMs are back to original state.
  • It checks the performance of the application running on the VMware VMs.

VMware VM Poweroff

Use cases

  • VMware VM poweroff determines the resilience of an application to random power failures.
  • It determines how efficiently an application recovers and restarts the services.
note
  • Kubernetes >= 1.17 is required to execute this fault.
  • Appropriate vCenter permissions should be provided to start and stop the VMs.
  • The VM should be in a healthy state before and after injecting chaos.
  • Kubernetes secret has to be created that has the Vcenter credentials in the CHAOS_NAMESPACE. VM credentials can be passed as secrets or as a ChaosEngine environment variable. Below is a sample secret file:
apiVersion: v1
kind: Secret
metadata:
name: vcenter-secret
namespace: litmus
type: Opaque
stringData:
VCENTERSERVER: XXXXXXXXXXX
VCENTERUSER: XXXXXXXXXXXXX
VCENTERPASS: XXXXXXXXXXXXX

Fault tunables

Mandatory fields

Variables Description Notes
APP_VM_MOIDS MOIDs of the VMware instance. After you open the VM in VCenter WebClient, you can find the MOID in the address field (VirtualMachine:vm-5365). Alternatively you can use the CLI to fetch the MOID. For example, vm-5365. For more information, go to stop VM based on MOID.

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. For more information, go to duration of the chaos.
CHAOS_INTERVAL Time interval between two successive instance terminations (in seconds). Defaults to 30s. For more information, go to chaos interval.
SEQUENCE Sequence of chaos execution for multiple instances. Defaults to parallel. Supports serial sequence as well. 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/Poweroff the VM by MOID

It contains the MOID of the VM instance. Tune it by using the APP_VM_MOIDS environment variable.

Use the following example to tune it:

# power-off the VMware VM
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: vm-poweroff
spec:
components:
env:
# MOID of the VM
- name: APP_VM_MOIDS
value: 'vm-53,vm-65'
- name: TOTAL_CHAOS_DURATION
VALUE: '60'