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.

IOChaos

IOChaos is the Schema for injecting I/O faults into containers. It allows you to simulate latency, faults, attribution overrides, and mistakes in I/O operations.

Metadata

apiVersion
string
required
chaos-mesh.org/v1alpha1
kind
string
required
IOChaos
metadata
ObjectMeta
Standard Kubernetes metadata. Refer to the Kubernetes API documentation for fields like name, namespace, labels, and annotations.

Spec

spec
IOChaosSpec
required
Defines the desired state of IOChaos.

IOChaosSpec

action
IOChaosType
required
Action defines the specific I/O chaos action.Supported values:
  • latency - Inject latency into I/O operations
  • fault - Inject faults (errno) into I/O operations
  • attrOverride - Override file attributes
  • mistake - Inject incorrect data into read/write operations
delay
string
Delay defines the value of I/O chaos action delay. A delay string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms".Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".Required when: action == 'latency'
errno
uint32
Errno defines the error code that returned by I/O action.Refer to: https://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.htmlRequired when: action == 'fault'
attr
AttrOverrideSpec
Attr defines the overridden attribution.Required when: action == 'attrOverride'
mistake
MistakeSpec
Mistake defines what types of incorrectness are injected to I/O operations.Required when: action == 'mistake'
path
string
Path defines the path of files for injecting I/O chaos action.
methods
[]IoMethod
Methods defines the I/O methods for injecting I/O chaos action.Default: all I/O methodsSee IoMethod for available values.
percent
int
default:"100"
Percent defines the percentage of injection errors and provides a number from 0-100.
volumePath
string
required
VolumePath represents the mount path of injected volume.
duration
*string
Duration represents the duration of the chaos action. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m".Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
remoteCluster
string
RemoteCluster represents the remote cluster where the chaos will be deployed.

Container Selector Fields

IOChaosSpec embeds ContainerSelector which includes:
selector
PodSelectorSpec
required
Selector is used to select pods that are used to inject chaos action.
mode
SelectorMode
required
Mode defines the mode to run chaos action.Supported values:
  • one - Select one random pod
  • all - Select all pods
  • fixed - Select a fixed number of pods
  • fixed-percent - Select a fixed percentage of pods
  • random-max-percent - Select a random percentage up to max
value
string
Value is required when mode is fixed, fixed-percent, or random-max-percent.
containerNames
[]string
ContainerNames indicates list of the name of affected container. If not set, the first container will be injected.

AttrOverrideSpec

AttrOverrideSpec defines file attribute overrides.
ino
*uint64
Inode number override.
size
*uint64
File size override.
blocks
*uint64
Number of blocks override.
atime
*Timespec
Access time override.
mtime
*Timespec
Modification time override.
ctime
*Timespec
Change time override.
kind
*FileType
File type override. Valid values: namedPipe, charDevice, blockDevice, directory, regularFile, symlink, socket.
perm
*uint16
File permissions override.
Number of hard links override.
uid
*uint32
User ID override.
gid
*uint32
Group ID override.
rdev
*uint32
Device ID override.

MistakeSpec

MistakeSpec defines incorrect data injection for I/O operations.
filling
FillingType
Filling determines what is filled in the mistake data.Valid values:
  • zero - Fill with zeros
  • random - Fill with random data
maxOccurrences
int64
There will be [1, MaxOccurrences] segments of wrong data.Minimum: 1
maxLength
int64
Max length of each wrong data segment in bytes.Minimum: 1

IoMethod

IoMethod represents FUSE I/O operation methods that can be targeted:
  • lookup, forget, getattr, setattr, readlink
  • mknod, mkdir, unlink, rmdir, symlink
  • rename, link, open, read, write
  • flush, release, fsync, opendir, readdir
  • releasedir, fsyncdir, statfs
  • setxattr, getxattr, listxattr, removexattr
  • access, create, getlk, setlk, bmap

IOChaosStatus

conditions
[]ChaosCondition
Conditions represents the current global condition of the chaos.
experiment
ExperimentStatus
Experiment records the last experiment state.
instances
map[string]int64
Instances always specifies podiochaos generation or empty.

Example

apiVersion: chaos-mesh.org/v1alpha1
kind: IOChaos
metadata:
  name: io-delay-example
  namespace: chaos-mesh
spec:
  action: latency
  mode: one
  selector:
    namespaces:
      - default
    labelSelectors:
      app: myapp
  volumePath: /var/data
  path: /var/data/*
  delay: '100ms'
  percent: 50
  duration: '30s'

Build docs developers (and LLMs) love