Node memory hog
Node memory hog causes memory resource exhaustion on the Kubernetes node.
- It is injected using a helper pod running the Linux stress-ng tool (a workload generator).
- The chaos affects the application for a duration specified by the
TOTAL_CHAOS_DURATION
environment variable.
Usage
View fault usage
Default validations
The target nodes should be in the ready state before and after injecting chaos.
Fault tunables
Fault tunables
Mandatory fields
Variables | Description | Notes |
---|---|---|
TARGET_NODES | Comma-separated list of nodes subject to node I/O stress. | For example, node-1,node-2 . |
NODE_LABEL | It contains the node label that is used to filter the target nodes. | It is mutually exclusive with the TARGET_NODES environment variable. If both are provided, TARGET_NODES takes precedence. |
Optional fields
Variables | Description | Notes |
---|---|---|
TOTAL_CHAOS_DURATION | Duration that you specify, through which chaos is injected into the target resource (in seconds). | Default to 120s. |
LIB_IMAGE | Image used to run the stress command. | Defaults to litmuschaos/go-runner:latest . |
MEMORY_CONSUMPTION_PERCENTAGE | Percent of the total node memory capacity. | Defaults to 30. |
MEMORY_CONSUMPTION_MEBIBYTES | Amount of the total available memory (in mebibytes). It is mutually exclusive with MEMORY_CONSUMPTION_PERCENTAGE . | For example, 256. |
NUMBER_OF_WORKERS | Number of VM workers involved in the stress. | Defaults to 1. |
RAMP_TIME | Period to wait before and after injecting chaos (in seconds). | For example, 30s. |
NODES_AFFECTED_PERC | Percentage of the total nodes to target. It takes numeric values only. | Defaults to 0 (corresponds to 1 node). |
SEQUENCE | Sequence of chaos execution for multiple target pods. | Defaults to parallel. Supports serial sequence as well. |
Fault examples
Common and node-specific tunables
Refer to the common attributes and node-specific tunables to tune the common tunables for all faults and node specific tunables.
Memory consumption percentage
It specifies the amount of memory consumed (in percentage). You can tune it using the MEMORY_CONSUMPTION_PERCENTAGE
environment variable.
Use the following example to tune this:
# stress the memory of the targeted node with MEMORY_CONSUMPTION_PERCENTAGE of node capacity
# it is mutually exclusive with the MEMORY_CONSUMPTION_MEBIBYTES.
# if both are provided then it will use MEMORY_CONSUMPTION_PERCENTAGE for stress
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
chaosServiceAccount: litmus-admin
experiments:
- name: node-memory-hog
spec:
components:
env:
# percentage of total node capacity to be stressed
- name: MEMORY_CONSUMPTION_PERCENTAGE
value: '10' # in percentage
- name: TOTAL_CHAOS_DURATION
VALUE: '60'
Memory consumption mebibytes
It specifies the amount of memory available. You can tune it using the MEMORY_CONSUMPTION_MEBIBYTES
environment variable. It is mutually exclusive with the MEMORY_CONSUMPTION_PERCENTAGE
environment variable. If MEMORY_CONSUMPTION_PERCENTAGE
environment variable is set, then it uses this value for the stress.
Use the following example to tune it:
# stress the memory of the targeted node with given MEMORY_CONSUMPTION_MEBIBYTES
# it is mutually exclusive with the MEMORY_CONSUMPTION_PERCENTAGE.
# if both are provided then it will use MEMORY_CONSUMPTION_PERCENTAGE for stress
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
chaosServiceAccount: litmus-admin
experiments:
- name: node-memory-hog
spec:
components:
env:
# node memory to be stressed
- name: MEMORY_CONSUMPTION_MEBIBYTES
value: '500' # in MiBi
- name: TOTAL_CHAOS_DURATION
VALUE: '60'
Workers for stress
It specifies the number of workers for stress. You can tune it using the NUMBER_OF_WORKERS
environment variable.
Use the following example to tune it:
# provide for the workers count for the stress
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
chaosServiceAccount: litmus-admin
experiments:
- name: node-memory-hog
spec:
components:
env:
# total number of workers involved in stress
- name: NUMBER_OF_WORKERS
value: '1'
- name: TOTAL_CHAOS_DURATION
VALUE: '60'