PhysicalMachineChaos allows you to inject various types of faults into physical machines, bare-metal servers, or virtual machines outside of Kubernetes. This is useful for testing how your Kubernetes applications handle failures in external infrastructure.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.
Actions
PhysicalMachineChaos supports a wide range of actions across multiple categories:Stress Actions
- stress-cpu: Stress CPU resources
- stress-mem: Stress memory resources
Disk Actions
- disk-read-payload: Generate disk read I/O
- disk-write-payload: Generate disk write I/O
- disk-fill: Fill disk space
Network Actions
- network-corrupt: Corrupt network packets
- network-duplicate: Duplicate network packets
- network-loss: Drop network packets
- network-delay: Add network latency
- network-partition: Create network partitions
- network-dns: Manipulate DNS responses
- network-bandwidth: Limit network bandwidth
- network-flood: Flood network with traffic
- network-down: Take network interface down
Process Actions
- process: Kill or signal processes
JVM Actions
- jvm-exception: Throw exceptions in JVM
- jvm-gc: Trigger garbage collection
- jvm-latency: Add method latency
- jvm-return: Modify return values
- jvm-stress: Stress JVM resources
- jvm-rule-data: Custom Byteman rules
- jvm-mysql: MySQL JDBC fault injection
Time Actions
- clock: Skew system clock
Redis Actions
- redis-expiration: Set key expiration
- redis-penetration: Cache penetration attack
- redis-cacheLimit: Limit cache size
- redis-restart: Restart Redis Sentinel
- redis-stop: Stop Redis Sentinel
Kafka Actions
- kafka-fill: Fill Kafka disk
- kafka-flood: Flood Kafka with messages
- kafka-io: Make Kafka non-readable/writable
HTTP Actions
- http-abort: Abort HTTP requests
- http-delay: Add HTTP latency
- http-config: Modify HTTP proxy config
- http-request: Send HTTP requests
File Actions
- file-create: Create files/directories
- file-modify: Modify file permissions
- file-delete: Delete files/directories
- file-rename: Rename files
- file-append: Append data to files
- file-replace: Replace file content
VM Actions
- vm: VM-related operations
Custom Actions
- user_defined: Execute custom commands
Spec Fields
The physical machine chaos action to perform. See the Actions section above for all available options.
List of physical machine addresses. Deprecated - use
selector instead.Selector to choose physical machines.
Selection mode for target machines.Options:
one, all, fixed, fixed-percent, random-max-percentRequired when mode is
fixed, fixed-percent, or random-max-percent.Duration of the chaos action (e.g.,
30s, 5m, 1h).Remote cluster name where the chaos will be deployed.
Action-Specific Parameters
Each action has specific parameters. Here are some common examples:Stress CPU
CPU load percentage per worker (0-100).
Number of workers to apply the stressor.
Additional stress-ng options.
Network Delay
Egress delay time (e.g.,
100ms, 1s).Jitter time.
Correlation percentage.
Network interface to impact.
Target IP addresses.
Process
Process name or PID.
Signal number to send.
Command to run when recovering.
User Defined
Command to execute for attack.
Command to execute for recovery.
Prerequisites
PhysicalMachine Object
You must first create PhysicalMachine objects representing your physical infrastructure:Chaosd Service
Each physical machine must run the Chaosd service, which:- Runs as a daemon on the physical machine
- Listens for chaos commands from Chaos Mesh
- Executes the requested chaos actions
- Reports status back to Chaos Mesh
Examples
Network Delay on Physical Machine
140.82.112.3 on the ens33 network interface.
Stress CPU on Physical Machines
Kill Process
Disk Fill
/mnt/data using fallocate.
Custom User Defined Action
Implementation Details
PhysicalMachineChaos works by:- Selecting PhysicalMachine objects based on the selector
- Communicating with the Chaosd service running on each selected machine
- Sending the chaos action and parameters to Chaosd
- Chaosd executes the action locally on the physical machine
- After the duration expires, Chaosd executes recovery actions
api/v1alpha1/physical_machine_chaos_types.go:22-773
Selector Modes
Themode field determines how many physical machines are selected:
- one: Select one random machine
- all: Select all matching machines
- fixed: Select a fixed number (specified in
value) - fixed-percent: Select a percentage (specified in
value) - random-max-percent: Select up to a random percentage (specified in
value)
api/v1alpha1/physical_machine_chaos_types.go:129-139
Important Notes
- Chaosd must be installed and running on all target physical machines
- Ensure proper network connectivity between Chaos Mesh and Chaosd
- Many actions require root/elevated privileges on the physical machine
- Test in non-production environments first
- The
addressfield is deprecated; use PhysicalMachine objects with selectors instead - For network actions, ensure you know the correct network interface names
- Some actions (like
user_defined) can be dangerous if not used carefully