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.

DNSChaos allows you to inject DNS faults, including returning errors or random IP addresses for DNS queries.

API Version and Kind

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

Metadata

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

Spec Fields

spec
DNSChaosSpec
required
Defines the behavior of the DNS chaos experiment.

DNSChaosSpec

action
DNSChaosAction
required
Specific DNS chaos action to perform.Enum values:
  • error - Return an error when sending DNS request
  • random - Return a random IP address when sending DNS request
Default: error
selector
ContainerSelector
required
Selector for targeting containers. See ContainerSelector in Common Types.Inherits all fields from ContainerSelector (inline), including:
  • Pod selection criteria
  • Mode (one/all/fixed/fixed-percent/random-max-percent)
  • Value (for fixed modes)
  • Container names
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
patterns
[]string
Domain name patterns to affect. Supports placeholder ? and wildcard *.Notes:
  • The wildcard * must be at the end of the string. For example, chaos-*.org is invalid.
  • If patterns is empty, will affect all domain names.
Example:
patterns:
  - "google.com"
  - "github.*"
  - "chaos-mes?.org"
This will affect:
  • google.com (exact match)
  • github.com, github.io (wildcard match)
  • chaos-mesh.org (placeholder match)
remoteCluster
string
Name of the remote cluster where the chaos will be deployed. If not specified, chaos is applied to the local cluster.

Status Fields

status
DNSChaosStatus
Current status of the chaos experiment.

DNSChaosStatus

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

Example

apiVersion: chaos-mesh.org/v1alpha1
kind: DNSChaos
metadata:
  name: dns-error
  namespace: chaos-mesh
spec:
  action: error
  mode: all
  selector:
    namespaces:
      - default
    labelSelectors:
      app: web
  patterns:
    - "google.com"
    - "*.github.com"
  duration: "5m"