How to fix Name or service not known: hostname resolution failed in Kubernetes

KubernetesINTERMEDIATEHIGHUpdated Dec 7, 2025ยท 97 views

DNS resolution fails for hostnames from within pods. CoreDNS pods are not running, DNS queries timeout, or upstream DNS is unreachable.

Quick fix

Fixes Name or service not known: hostname resolution failed

  1. Step 1
  2. Step 2
  3. Step 3
  4. Step 4
  5. Step 5
kubernetes โ€” error
# Name or service not known: hostname resolution failed
Name or service not known: hostname resolution failed

What this error means

This error occurs when pods cannot resolve hostnames to IP addresses via DNS. Kubernetes uses CoreDNS to provide DNS services. When DNS is unavailable, misconfigured, or upstream resolvers are unreachable, hostname resolution fails and pods cannot communicate with services.

Typical symptoms

  • nslookup or getent fails with "Name or service not known"
  • Pods cannot resolve Kubernetes service names
  • External hostname resolution fails (google.com, etc.)
  • DNS queries timeout after 5-10 seconds
  • CoreDNS pods not running or crashing
  • API server unreachable (cannot resolve "kubernetes" service)
  • wget/curl fails with "Name or service not known"

Common causes

  1. CoreDNS pods not running or evicted
  2. CoreDNS ConfigMap corrupted or misconfigured
  3. Upstream DNS server unreachable (8.8.8.8 blocked)
  4. Network policy blocking DNS port 53
  5. Node firewall blocking port 53 (UDP/TCP)
  6. Pod /etc/resolv.conf pointing to non-existent nameserver
  7. CoreDNS logs showing plugin errors

How to fix "Name or service not known: hostname resolution failed"

1Step 1

First diagnostic step

2Step 2

Second diagnostic step

3Step 3

Third diagnostic step

4Step 4

Fourth diagnostic step

5Step 5

Fifth diagnostic step

Advanced notes

Additional notes and platform-specific considerations.

Frequently asked questions

What does "Name or service not known: hostname resolution failed" mean?
This error occurs when pods cannot resolve hostnames to IP addresses via DNS. Kubernetes uses CoreDNS to provide DNS services. When DNS is unavailable, misconfigured, or upstream resolvers are unreachable, hostname resolution fails and pods cannot communicate with services.
How do I fix "Name or service not known: hostname resolution failed"?
DNS resolution fails for hostnames from within pods. CoreDNS pods are not running, DNS queries timeout, or upstream DNS is unreachable.
What causes "Name or service not known: hostname resolution failed"?
CoreDNS pods not running or evicted CoreDNS ConfigMap corrupted or misconfigured Upstream DNS server unreachable (8.8.8.8 blocked)
Is the "Name or service not known: hostname resolution failed" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading