NetworkChaos allows you to inject various network faults into pods to test how your application handles network disruptions, latency, packet loss, and bandwidth limitations.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.
Supported Actions
NetworkChaos supports seven types of network impairments:- delay: Add latency to network packets
- loss: Drop network packets
- duplicate: Duplicate network packets
- corrupt: Corrupt network packets
- partition: Create network partitions between pods
- bandwidth: Limit network bandwidth
- netem: Combine multiple network impairments (delay, loss, duplicate, corrupt)
Configuration
Basic Example
Spec Fields
The network chaos action to perform. Must be one of:
delay: Add network latencyloss: Drop packetsduplicate: Duplicate packetscorrupt: Corrupt packetspartition: Create network partitionbandwidth: Limit bandwidthnetem: Combine multiple impairments
Specifies the source pods for the chaos experiment. See PodChaos documentation for selector details.
Selection mode:
one, all, fixed, fixed-percent, or random-max-percentDuration of the chaos action. Format: “300ms”, “1.5h”, “2h45m”
Direction of network traffic to affect:
to: Traffic from source to targetfrom: Traffic from target to sourceboth: Bidirectional traffic
Target pods for the network chaos (used with partition and directional actions). If not specified, affects all traffic.
External IP addresses or hostnames to target (for affecting traffic outside the cluster)
Network device to be affected (e.g., “eth0”). If not specified, uses the default network interface.
Network device to be affected in target scope
Action-Specific Fields
Delay configuration (required when action is
delay or netem)Packet loss configuration (required when action is
loss or netem)Packet duplication configuration (required when action is
duplicate or netem)Packet corruption configuration (required when action is
corrupt or netem)Bandwidth limitation configuration (required when action is
bandwidth)Remote cluster where chaos will be deployed
Examples
Network Delay
Add 90ms latency with jitter:Packet Loss
Drop 25% of packets:Packet Corruption
Corrupt 40% of packets:Packet Duplication
Duplicate 40% of packets:Network Partition
Create a network partition between two sets of pods:Bandwidth Limitation
Limit bandwidth to 100kbps:Combined Network Impairments (Netem)
Apply multiple network impairments simultaneously:Use Cases
Testing High-Latency Networks
Use thedelay action to simulate network conditions in geographically distributed systems or slow network connections.
Simulating Unreliable Networks
Combineloss, duplicate, and corrupt actions to test application behavior under poor network conditions.
Testing Network Partitions
Use thepartition action to verify that your application handles split-brain scenarios and network segmentation correctly.
Bandwidth Constraints
Use thebandwidth action to test how your application performs under bandwidth-limited conditions.
Best Practices
- Start with Moderate Values: Begin with lower percentages for loss, corruption, and duplication to understand baseline impact
- Use Correlation: The correlation parameter makes chaos more realistic by creating patterns in network behavior
- Test Bidirectionally: Use
direction: bothto test how your application handles symmetric network issues - External Targets: Use
externalTargetsto test how your application handles external service degradation - Monitor Metrics: Always monitor application metrics, latency, and error rates during experiments
- Gradual Rollout: Start with
mode: onebefore affecting all pods
Notes
- Network chaos is implemented using Linux tc (traffic control) and requires appropriate kernel capabilities
- The
netemaction allows combining multiple network impairments in a single experiment - Direction applies to partition and can be used with other actions when target is specified
- External targets must be specified as IP addresses or resolvable hostnames
- Network device names are platform-specific (common: eth0, ens3, etc.)