Simulate DNS Faults
DNSChaos is used to simulate wrong DNS responses. For example, DNSChaos can return an error or return a random IP address when receiving a DNS request.
Before creating a DNSChaos experiment using Chaos Mesh, you need to deploy a special DNS service to inject faults:
After executing the above commands, check if the DNS service status is normal:
Make sure that the Pod status is .
Currently, DNSChaos only supports record types
A
andAAAA
.
Open Chaos Dashboard, and click NEW EXPERIMENT on the page to create a new experiment:
In the Choose a Target area, choose DNS FAULT and select a specific behavior, such as ERROR. Then fill out the matching rules.
According to the matching rules configured in the screenshot, the DNS FAULT takes effect for domains including
google.com
,chaos-mesh.org
, andgithub.com
, which means that an error will be returned when a DNS request is sent to these three domains. For details of specific matching rules, refer to the description of thepatterns
field in Configuration Description.Submit the experiment information.
Write the experiment configuration to the
dnschaos.yaml
file:This configuration can take effect for domains including
google.com
,chaos-mesh.org
, andgithub.com
, which means that an IP address will be returned when a DNS request is sent to these three domains. For specific matching rules, refer to thepatterns
description in .After the configuration file is prepared, use to create an experiment:
note" class="reference-link">note
When
patterns
is not configured, faults will be injected for all domains.