Skip to main content

VMware network loss

VMware network loss injects network packet loss from the VMware VM(s) into the application (or service).

  • This results in flaky access to the application.
  • It checks the performance of the application (or process) running on the VMware VM(s).

VMware Network Loss

Usage

View fault usage
This fault simulates issues within the VM network (or microservice) communication across services in different hosts. It helps determine the impact of degradation while accessing a microservice. The VM may stall (or get corrupted) while waiting endlessly for a packet. The fault limits the impact (blast radius) to the traffic that you wish to test by specifying the IP addresses. It simulates degraded network with varied percentages of dropped packets between microservices, loss of access to specific third party (or dependent) services (or components), blackhole against traffic to a given AZ (failure simulation of availability zones), and network partitions (split-brain) between peer replicas for a stateful application.

Prerequisites

  • Kubernetes > 1.16
  • Vcenter access to stop and start the VM.
  • Kubernetes secret that has Vcenter credentials in the CHAOS_NAMESPACE. 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

Note

You can pass the VM credentials as secrets or as a ChaosEngine environment variable.

Default validations

The VM should be in a healthy state before and after chaos.

Fault tunables

Fault tunables

Mandatory fields

Variables Description Notes
VM_NAMES Names of the target VMs as comma-separated values. For example, vm-1,vm-2.
VM_USER_NAME Username of the target VM(s). Multiple usernames can be provided as comma-separated values which corresponds to more than one VM under chaos. It is used to run the govc command.
VM_PASSWORD Password for the target VM(s). It is used to run the govc command.

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 terminations (in seconds). Defaults to 30s.
NETWORK_PACKET_LOSS_PERCENTAGE Packets lost during transmission (in percent). Defaults to 100 %.
DESTINATION_IPS IP addresses of the services or pods whose accessibility you want to affect. You can also specify a CIDR block. Comma-separated IPs (or CIDRs) can be provided. If it has not been provided, network chaos is induced on all IPs (or destinations).
DESTINATION_HOSTS DNS names (or FQDN names) of the services whose accessibility is affected. If it has not been provided, network chaos is induced on all IPs (or destinations).
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.

Secret fields

Variables Description Notes
GOVC_URL vCenter server URL used to perform API calls using the govc command. It is derived from a secret.
GOVC_USERNAME Username of the vCenter server used for authentication purposes. It can be set up using a secret.
GOVC_PASSWORD Password of the vCenter server used for authentication purposes. It can be set up using a secret.
GOVC_INSECURE Runs the govc command in insecure mode. It is set to true. It can be set up using a secret.

Fault examples

Common fault tunables

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

Network packet loss

It defines the network packet loss (in percentage) that is injected to the VM. You can tune it using the NETWORK_PACKET_LOSS_PERCENTAGE environment variable.

Use the following example to tune it:

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: VMware-engine
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-network-loss
spec:
components:
env:
# network packet loss percentage
- name: NETWORK_PACKET_LOSS_PERCENTAGE
value: '100'
- name: VM_NAME
value: 'vm-1,vm-2'
- name: VM_USER_NAME
value: 'ubuntu,debian'
- name: VM_PASSWORD
value: '123,123'

Run with destination IPs and destination hosts

The network faults interrupt traffic for all the IPs/hosts by default. You can tune this using the DESTINATION_IPS and DESTINATION_HOSTS environment variables, respectively.

DESTINATION_IPS: It contains the IP addresses of the services or the CIDR blocks (range of IPs) that impacts its accessibility. DESTINATION_HOSTS: It contains the DNS names of the services that impact its accessibility.

Use the following example to tune it:

## it injects the chaos for the egress traffic for specific ips/hosts
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: VMware-engine
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-network-loss
spec:
components:
env:
# supports comma separated destination ips
- name: DESTINATION_IPS
value: '8.8.8.8,192.168.5.6'
# supports comma separated destination hosts
- name: DESTINATION_HOSTS
value: 'google.com'
- name: VM_NAME
value: 'vm-1,vm-2'
- name: VM_USER_NAME
value: 'ubuntu,debian'
- name: VM_PASSWORD
value: '123,123'

Network interface

The name of the ethernet interface that shapes the traffic. You can tune it using the NETWORK_INTERFACE environment variable. Its default value is eth0.

Use the following example to tune it:

## it injects the chaos for the egress traffic for specific ips/hosts
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: VMware-engine
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-network-loss
spec:
components:
env:
# name of the network interface
- name: NETWORK_INTERFACE
value: 'eth0'
- name: VM_NAME
value: 'vm-1,vm-2'
- name: VM_USER_NAME
value: 'ubuntu,debian'
- name: VM_PASSWORD
value: '123,123'