DNSChaos Experiment
DNSChaos allows you to simulate fault DNS responses such as a DNS error or a random IP address after a request is sent.
To create DNSChaos experiments in Chaos Mesh, you need to deploy a DNS service in Chaos Mesh by executing the command below:
Make sure the Pod’s is Running
.
Below is a sample DNSChaos configuration file:
action: Defines the chaos action for DNS chaos. Supported actions are:
error
- Get an error when sending the DNS request- - Get a random IP when sending the DNS request
- selector: Specifies the target pods for chaos injection. For more details, see Define the Scope of Chaos Experiment.
The chaos DNS service runs CoreDNS with the plugin. If the CoreDNS service in your Kubernetes cluster contains some special configurations, you can edit configMap
dns-server-config
to make the configuration of the chaos DNS service consistent with that of the K8s CoreDNS service as shown below: