Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/chaos-mesh/chaos-mesh/llms.txt

Use this file to discover all available pages before exploring further.

PhysicalMachineChaos allows you to inject various types of faults into physical machines, including stress, disk, network, process, JVM, clock, Redis, Kafka, HTTP, file, and custom faults.

API Version and Kind

apiVersion: chaos-mesh.org/v1alpha1
kind: PhysicalMachineChaos

Metadata

Standard Kubernetes object metadata.
metadata.name
string
required
Name of the PhysicalMachineChaos resource.
metadata.namespace
string
Namespace of the PhysicalMachineChaos resource. Defaults to default.

Spec Fields

spec
PhysicalMachineChaosSpec
required
Defines the behavior of the physical machine chaos experiment.

PhysicalMachineChaosSpec

action
PhysicalMachineChaosAction
required
Specific physical machine chaos action to perform.Enum values:
  • Stress: stress-cpu, stress-mem
  • Disk: disk-read-payload, disk-write-payload, disk-fill
  • Network: network-corrupt, network-duplicate, network-loss, network-delay, network-partition, network-dns, network-bandwidth, network-flood, network-down
  • Process: process
  • JVM: jvm-exception, jvm-gc, jvm-latency, jvm-return, jvm-stress, jvm-rule-data, jvm-mysql
  • Clock: clock
  • Redis: redis-expiration, redis-penetration, redis-cacheLimit, redis-restart, redis-stop
  • Kafka: kafka-fill, kafka-flood, kafka-io
  • HTTP: http-abort, http-delay, http-config, http-request
  • File: file-create, file-modify, file-delete, file-rename, file-append, file-replace
  • VM: vm
  • User Defined: user_defined
selector
PhysicalMachineSelector
required
Selector for targeting physical machines.
duration
*string
Duration of the chaos action.A duration string with format like "300ms", "1.5h", or "2h45m".Valid time units: ns, us (µs), ms, s, m, h
remoteCluster
string
Name of the remote cluster where the chaos will be deployed. If not specified, chaos is applied to the local cluster.

ExpInfo Fields

The spec includes action-specific configuration inline via ExpInfo. Only the field matching the action is used:
stress-cpu
*StressCPUSpec
CPU stress configuration. Used when action is stress-cpu.
  • load (int) - P percent loading per CPU worker (0-100)
  • workers (int) - Number of workers
  • options ([]string) - Extended stress-ng options
stress-mem
*StressMemorySpec
Memory stress configuration. Used when action is stress-mem.
  • size (string) - Bytes consumed per worker (e.g., “1G”, “50%”)
  • options ([]string) - Extended stress-ng options
disk-read-payload
*DiskPayloadSpec
Disk read configuration. Used when action is disk-read-payload.
disk-write-payload
*DiskPayloadSpec
Disk write configuration. Used when action is disk-write-payload.
disk-fill
*DiskFillSpec
Disk fill configuration. Used when action is disk-fill.
network-corrupt
*NetworkCorruptSpec
Network corruption configuration. Used when action is network-corrupt.
network-duplicate
*NetworkDuplicateSpec
Network duplication configuration. Used when action is network-duplicate.
network-loss
*NetworkLossSpec
Network loss configuration. Used when action is network-loss.
network-delay
*NetworkDelaySpec
Network delay configuration. Used when action is network-delay.
network-partition
*NetworkPartitionSpec
Network partition configuration. Used when action is network-partition.
network-dns
*NetworkDNSSpec
Network DNS configuration. Used when action is network-dns.
network-bandwidth
*NetworkBandwidthSpec
Network bandwidth configuration. Used when action is network-bandwidth.
network-flood
*NetworkFloodSpec
Network flood configuration. Used when action is network-flood.
network-down
*NetworkDownSpec
Network down configuration. Used when action is network-down.
process
*ProcessSpec
Process configuration. Used when action is process.
  • process (string) - Process name or PID
  • signal (int) - Signal number to send
  • recoverCmd (string) - Command to run when recovering
For JVM, clock, Redis, Kafka, HTTP, file, VM, and user-defined actions, see the complete type definitions in the source code at api/v1alpha1/physical_machine_chaos_types.go.

Status Fields

status
PhysicalMachineChaosStatus
Current status of the chaos experiment.

PhysicalMachineChaosStatus

conditions
[]ChaosCondition
Current global conditions. See ChaosStatus in Common Types.
experiment
ExperimentStatus
Last known experiment state including desired phase and container records.

Examples

CPU Stress

apiVersion: chaos-mesh.org/v1alpha1
kind: PhysicalMachineChaos
metadata:
  name: cpu-stress
  namespace: chaos-mesh
spec:
  action: stress-cpu
  mode: one
  selector:
    namespaces:
      - default
    physicalMachines:
      default:
        - physical-machine-1
  stress-cpu:
    load: 80
    workers: 2
  duration: 5m

Network Delay

apiVersion: chaos-mesh.org/v1alpha1
kind: PhysicalMachineChaos
metadata:
  name: network-delay
  namespace: chaos-mesh
spec:
  action: network-delay
  mode: all
  selector:
    labelSelectors:
      role: database
  network-delay:
    latency: "100ms"
    jitter: "10ms"
    device: "eth0"
  duration: 10m