Skip to main content

Common tunables for all faults

Fault tunables common to all the faults are provided at .spec.experiment[*].spec.components.env in the chaosengine.

Duration of the chaos

It defines the total duration of the chaos injection (in seconds). You can tune it using the TOTAL_CHAOS_DURATION environment variable.

Use the following example to tune it:

# defines total time duration of the chaos
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-delete
spec:
components:
env:
# time duration for the chaos execution
- name: TOTAL_CHAOS_DURATION
VALUE: '60'

Multiple iterations of chaos

Multiple iterations of chaos can be tuned by setting the CHAOS_INTERVAL environment variable. This variable defines the delay between each chaos iteration.

Use the following example to tune it:

# defines delay between each successive iteration of the chaos
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-delete
spec:
components:
env:
# delay between each iteration of chaos
- name: CHAOS_INTERVAL
value: '15'
# time duration for the chaos execution
- name: TOTAL_CHAOS_DURATION
VALUE: '60'

Chaos interval

Multiple iterations of chaos can be tuned by setting the CHAOS_INTERVAL environment variable. This variable defines the delay between each chaos iteration.

Use the following example to tune it:

# defines delay between each successive iteration of the chaos
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-delete
spec:
components:
env:
# delay between each iteration of chaos
- name: CHAOS_INTERVAL
value: '15'
# time duration for the chaos execution
- name: TOTAL_CHAOS_DURATION
VALUE: '60'

Ramp time

It defines the period to wait before and after injecting chaos. You can tune it using the RAMP_TIME environment variable. It is in unit of seconds.

Use the following example to tune it:

# waits for the ramp time before and after injection of chaos
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-delete
spec:
components:
env:
# waits for the time interval before and after injection of chaos
- name: RAMP_TIME
value: '10' # in seconds

Sequence of chaos execution

It defines the sequence of the chaos execution in case of multiple targets. You can tune it using the SEQUENCE environment variable. It supports the following modes:

  • parallel: The chaos is injected in all the targets at once.
  • serial: The chaos is injected in all the targets one by one. The default value of SEQUENCE is parallel.

Use the following example to tune it:

# define the order of execution of chaos in case of multiple targets
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-delete
spec:
components:
env:
# define the sequence of execution of chaos in case of mutiple targets
# supports: serial, parallel. default: parallel
- name: SEQUENCE
value: 'parallel'

Instance ID

It defines a user-defined string that holds metadata/info about the current run/instance of chaos. For example: 04-05-2020-9-00. This string is appended as a suffix in the chaosresult CR name. It can be tuned using the INSTANCE_ID environment variable.

Use the following example to tune it:

# provide to append user-defined suffix in the end of chaosresult name
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-delete
spec:
components:
env:
# user-defined string appended as suffix in the chaosresult name
- name: INSTANCE_ID
value: '123'

Image used by the helper pod

It defines the image which is used to launch the helper pod, if applicable. It can be tuned using the LIB_IMAGE environment variable. It is supported by container-kill, network-faults, stress-faults, dns-faults, disk-fill, kubelet-service-kill, docker-service-kill, and node-restart faults.

Use the following example to tune it:

# it contains the lib image used for the helper pod
# it support [container-kill, network-faults, stress-faults, dns-faults, disk-fill,
# kubelet-service-kill, docker-service-kill, node-restart] faults
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: container-kill
spec:
components:
env:
# name of the lib image
- name: LIB_IMAGE
value: 'litmuschaos/go-runner:latest'