Pod DNS error
Block DNS resolution for selected hostnames inside a target Kubernetes pod to test how the application handles upstream lookup failures and cluster DNS outages.
Pod DNS error is a Kubernetes pod-level chaos fault that makes DNS lookups from inside the target pod fail for a configurable list of hostnames (or all hostnames) for a configurable duration. The target pod's resolver returns errors as if the upstream DNS server were unreachable. When the fault ends, DNS resolution returns to normal immediately.
Use this fault to test how an application handles DNS failures: a partial CoreDNS outage that breaks one upstream service, a misconfigured Service entry, or a transient resolver hiccup that strands a long-lived client.
Use cases
Run this fault when you want to answer concrete questions like:
Scoped upstream outage: Block resolution of
payments.example.comonly and verify whether the application surfaces a clear "upstream unavailable" error or hangs at the connect step.DNS caching behavior: Many runtimes cache DNS lookups indefinitely. Does the application re-resolve when the lookup fails, or does it serve a stale, now-broken address?
Client retry budgets: When a DNS lookup fails, does the client retry the lookup, surface the failure to the caller, or thrash?
Service discovery resilience: A
Serviceselector matches no pods. Does the discovery path tolerateNXDOMAINfor the service's DNS name, or does the entire request pipeline fail?Partial cluster DNS outage simulation: Block resolution for a specific keyword (with
MATCH_SCHEME=substring) to simulate a failing CoreDNS plugin for one zone.
Prerequisites
Kubernetes version: 1.21 or later. Go to What's supported to confirm distribution support.
Target pods are Running: The application pods you intend to target are in the
Runningstate before the fault is launched.Privileged pods allowed: The cluster lets you schedule privileged pods in the chaos namespace. GKE Autopilot supports this fault but requires the one-time setup in Chaos on GKE Autopilot; other locked-down distributions may need similar exemptions.
Container runtime access: The chaos pod can reach the container runtime socket on the target node (
/run/containerd/containerd.sock,/var/run/docker.sock, or/var/run/crio/crio.sock).Workload selector defined: The chaos experiment knows the target workload by kind, namespace, and either names or labels.
Supported environments
Amazon EKS
Supported
Azure AKS
Supported
Google GKE
Supported
Red Hat OpenShift
Supported
Rancher
Supported
VMware Tanzu
Supported
Self-managed Kubernetes (CNCF-certified)
Supported
GKE Autopilot
Supported with Autopilot setup
EKS Fargate, ACI virtual nodes
Not supported (no access to container runtime sockets)
Permissions required
The fault runs under the chaos infrastructure's service account.
Resource (apiGroup)
Verbs
Why it is needed
pods ("")
get, list, create, delete, deletecollection, patch, update
Discover target pods and run the chaos pod on the same node
pods/log ("")
get, list, watch
Stream chaos pod logs for status and debugging
deployments, statefulsets, replicasets, daemonsets (apps)
get, list
Resolve the target workload to the pods it owns
events ("")
get, list, create, patch, update
Record fault progress as Kubernetes events
jobs (batch)
get, list, create, delete, deletecollection
Run the chaos job that drives the fault
The default Harness chaos infrastructure service account already includes these permissions.
Fault tunables
Configure the following fault parameters when you add Pod DNS error to an experiment in Chaos Studio. Defaults are shown for reference.
Chaos parameters
TARGET_HOSTNAMES
JSON-formatted list of hostnames or keywords to fail. Example: '["payments.example.com","auth"]'. Empty fails all DNS lookups.
""
MATCH_SCHEME
How TARGET_HOSTNAMES entries are matched against incoming queries: exact (full hostname match) or substring (any query containing the keyword).
exact
TRANSACTION_PERCENTAGE
Percentage of matched DNS queries to fail, between 0 and 100. 0 fails none; 100 fails every matched query.
0
TOTAL_CHAOS_DURATION
Duration of the fault in seconds.
60
Targeting
TARGET_PODS
Comma-separated list of pod names to target. Empty selects from the workload's pods using POD_AFFECTED_PERCENTAGE.
""
TARGET_CONTAINER
Container in the pod whose network namespace to enter. Empty targets the first container in the pod spec.
""
NODE_LABEL
Label selector to filter target pods by the node they run on. Empty disables node-based filtering.
""
POD_AFFECTED_PERCENTAGE
Percentage of the workload's pods to target. 0 means one pod.
0
SEQUENCE
When multiple pods are targeted, inject parallel (all at once) or serial (one after another).
parallel
Runtime and helper
CONTAINER_RUNTIME
Container runtime on the target nodes. One of containerd, docker, crio.
containerd
SOCKET_PATH
Path to the container runtime socket on the target node. Set to match CONTAINER_RUNTIME.
/run/containerd/containerd.sock
RAMP_TIME
Wait period in seconds before and after the fault. Go to ramp time to read how it is applied.
0
Tunables that apply to every chaos fault are documented in common tunables for all faults.
Configure for your container runtime
Set CONTAINER_RUNTIME and SOCKET_PATH to match the runtime on the target node:
CONTAINER_RUNTIME
SOCKET_PATH
containerd (default)
/run/containerd/containerd.sock
docker
/var/run/docker.sock
crio
/var/run/crio/crio.sock
Fault execution in brief
Intercepts DNS queries from inside the target container and returns an error response for the configured percentage of queries whose hostname matches TARGET_HOSTNAMES (or all queries if no list is supplied), so the application's resolver sees the lookup as failed.
Expected behavior during fault execution
DNS queries from inside the target container for hostnames that match
TARGET_HOSTNAMESandMATCH_SCHEMEreturn an error (typicallySERVFAILor equivalent), as if the upstream resolver were unreachable.The percentage of matched queries failed is set by
TRANSACTION_PERCENTAGE; the rest are forwarded to the cluster DNS resolver and answered normally.Queries that do not match (different hostname) are not affected. Already-resolved addresses cached by the runtime are not invalidated; the failure surfaces on the next lookup after the cache expires.
The application typically surfaces lookup failures as
getaddrinfo failed,temporary failure in name resolution, ordial tcp: lookup ... no such host. Some runtimes back off and retry; others fail the call immediately.
Signals to watch
Attach resilience probes to assert each layer:
Lookup error rate: Use a Prometheus probe on your DNS metrics or application's "name resolution failed" counter.
Caller error surface: Use an HTTP probe against the calling service to detect whether DNS errors leak through to end users as
5xxor hang as timeouts.Other dependencies stay reachable: Use a command probe to confirm a different hostname resolves correctly throughout the fault, isolating the impact to your target.
Verify the fault execution effect
While the experiment is running, confirm the right lookups are failing:
Resolve the target hostname from inside the pod.
The lookup should fail. With
nslookup, you should seeserver can't find ... SERVFAIL(or similar).Resolve an unaffected hostname.
The lookup should succeed at baseline speed, confirming the scope is contained to
TARGET_HOSTNAMES.
Recovery and cleanup
End of duration: The DNS interception is removed automatically and resolution returns to normal.
Abort the experiment: Stopping the experiment from Chaos Studio triggers the same cleanup path.
Failed cleanup: If automated cleanup did not complete, restart the target pod to reset its DNS state.
Limitations
Serverless Kubernetes (EKS Fargate, ACI virtual nodes): These platforms do not expose container runtime sockets and reject the privileged access the fault needs. GKE Autopilot is supported once the one-time setup in Chaos on GKE Autopilot is in place.
Windows containers: This fault is supported on Linux pods only.
Long DNS caches: Some runtimes (Java is a common example) cache successful lookups for a long time. The fault only affects new lookups; already-resolved IPs remain reachable until the cache expires.
hostNetworkpods: The fault operates inside the pod's network namespace. Pods usinghostNetwork: trueshare the host's resolver and are not affected.Custom DNS configurations: Pods that bypass cluster DNS (for example, with a custom
dnsConfigpointing to an external resolver) may not route queries through the path the fault intercepts.
Troubleshooting
Related faults
Pod DNS spoof: Return a wrong address for the lookup instead of failing it.
Pod network loss: Drop packets between the pod and upstreams instead of failing DNS.
Pod API block: Block API calls without breaking DNS.
Common pod fault tunables: Shared environment variables for selecting target pods and workloads.
Last updated
Was this helpful?