pod-memory-stress
Allocates memory inside the pod's cgroup, simulating memory pressure and testing OOM behavior.
Target kind: Pod
Implementation: Daemon (ExecStressChaos with stressorType: memory)
Rollback: Yes — sends CancelChaos to terminate stress-ng
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
workers | string | No | "1" | Number of memory stress worker threads |
size | string | No | "256m" | Memory to allocate per worker (e.g. 256m, 1g) |
duration | string | No | experiment duration | How long to run stress |
Example
apiVersion: chaos.chaosplane.io/v1alpha1
kind: ChaosExperiment
metadata:
name: pod-memory-stress-example
namespace: default
spec:
target:
kind: Pod
namespace: default
labelSelector:
matchLabels:
app: worker
action:
type: pod-memory-stress
parameters:
workers: "1"
size: "512m"
duration: "60s"
duration: 60s
rollback:
enabled: true
Rollback behavior
Sends CancelChaos RPC to the daemon, which terminates the stress-ng process and releases the allocated memory.
Implementation notes
The daemon runs stress-ng --vm N --vm-bytes SIZE inside the pod's cgroup. Memory allocation is subject to the pod's memory limits — if the pod has a resources.limits.memory set, the stress may trigger an OOM kill. This is intentional for testing OOM recovery.
Use abort conditions with a k8s probe to detect if the pod gets OOM-killed and abort the experiment.