Logo: K8s Coredns Troubleshooting

K8s Coredns Troubleshooting

Organisatioun
k8s-servant
k8s-coredns-troubleshooting

Benotzt dës Skill, wann den DNS vum Kubernetes-Cluster selwer Problemer mécht: CoreDNS-Pods sinn am Status CrashLoopBackOff („Error during parsing: Unknown directive“, „plugin/loop: Loop ... detected“), „reload failed“ no enger Ännerung vum Corefile, extern Nimm funktionéieren net, wärend Service-Nimm opgeléist ginn („;; connection timed out; no servers could be reached“, SERVFAIL, „plugin/errors: 2 ... i/o timeout“), eng eenzel Domain oder Stub-Domain funktionéiert net, rewrite- oder hosts-Einträg gräifen net, „Plugins not ready: \"kubernetes\"“, REFUSED oder „concurrent queries exceeded maximum“, lues DNS-Recherchen (ndots, Verspéidunge vu 5 s), NodeLocal DNSCache (169.254.20.10) oder d'AKS coredns-custom-, EKS-Add-on- a GKE kube-dns-ConfigMaps sinn betraff. Ënnersicht de Problem mat kubectl get a Logs a proposéiert Léisungen. Liest fir d'éischt a freet, éier eppes geännert gëtt.

Iwwersiicht

Editeurk8s-servant
Repositoryk8s-skills
Skill-Nummk8s-coredns-troubleshooting
Stären
36
Forks
7
Matgeliwwert Dateien
2
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    k8s-servant huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill K8s Coredns Troubleshooting an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-coredns-troubleshooting
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/k8s-servant/k8s-skills.git /tmp/k8s-skills
mkdir -p .claude/skills
cp -r /tmp/k8s-skills/skills/k8s-coredns-troubleshooting .claude/skills/k8s-coredns-troubleshooting
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert K8s Coredns Troubleshooting an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet K8s Coredns Troubleshooting automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass K8s Coredns Troubleshooting net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

CoreDNS troubleshooting

Find out why CoreDNS does not answer a name the way it should, and propose a fix. Read first, ask before changing. Run the investigation commands freely. Run a command under an "Ask first" line only after the user approves that exact command; if your credentials do not allow it, give it to the user to run. Never run a "Proposed fix"; hand it to the user.

CoreDNS runs in kube-system as the Deployment coredns (label k8s-app=kube-dns), behind the Service kube-dns, and reads its configuration, the Corefile, from the ConfigMap coredns. Each server block (.:53 { ... }, or example.com:53 { ... } for one domain) lists plugins: kubernetes answers names under cluster.local, forward sends everything else upstream (by default to the node's /etc/resolv.conf), cache, rewrite and hosts change answers, errors logs failures, loop stops CoreDNS when it would query itself, and reload reads an edited Corefile about 30 seconds after the ConfigMap reaches the pod. The default Corefile has no log plugin, so successful queries and NXDOMAIN answers are not logged.

The commands use placeholders: my-namespace, my-app (a Service), my-client (a pod whose lookups fail) and my-coredns-pod. Replace them with the real names. The CoreDNS image has no shell, so test lookups from a client pod. Never read Secrets.

When to use

  • CoreDNS pods crash, restart or are not Ready.
  • Names outside the cluster fail, or one domain fails, while Service names resolve.
  • DNS broke right after someone edited the coredns ConfigMap.
  • Lookups are slow, time out now and then, or get REFUSED.

Hand-offs, by skill name. When the evidence points elsewhere, continue with that skill; if it is not installed, keep going with the steps here and tell the user which skill would help:

  • Only one client fails for a Service name (wrong namespace in the name, dnsPolicy, a Service with no endpoints) or an egress NetworkPolicy blocks DNS: k8s-network-troubleshooting. On Cilium, a DNS-aware policy: k8s-cilium-troubleshooting.
  • The CoreDNS pods are Pending, evicted or OOMKilled because of their node: k8s-node-troubleshooting.
  • Failed to watch ... is forbidden for the coredns ServiceAccount: k8s-rbac-troubleshooting.

Investigate

Work through the steps in order. Stop when you have the cause and its evidence.

1. See CoreDNS's pods, Deployment and Service. A rollout that is stuck, a pod that restarts, or no endpoints for kube-dns each change where to look next.

bash
kubectl get deployment coredns -n kube-system
kubectl get pods -n kube-system -l k8s-app=kube-dns -o wide
kubectl get service kube-dns -n kube-system
kubectl get endpointslices -n kube-system -l kubernetes.io/service-name=kube-dns
kubectl get daemonset -n kube-system

A node-local-dns DaemonSet means NodeLocal DNSCache sits in front of CoreDNS (see the second reference). On GKE there is a kube-dns Deployment and no coredns ConfigMap.

2. Read CoreDNS's logs, current and, after a crash, previous. [ERROR] lines come from errors; [INFO] Reloading and plugin/reload lines show Corefile edits.

bash
kubectl logs -n kube-system -l k8s-app=kube-dns --tail=50 --prefix
kubectl logs -n kube-system my-coredns-pod --previous --tail=20
kubectl get events -n kube-system --field-selector involvedObject.kind=Pod --sort-by=.lastTimestamp

3. Read the Corefile and any custom ConfigMap the cluster adds to it. Note the line numbers: parse errors name them.

bash
kubectl get configmap coredns -n kube-system -o jsonpath='{.data.Corefile}'
kubectl get configmap coredns -n kube-system -o yaml
kubectl get configmap -n kube-system | grep -E 'coredns|dns'

4. Read the client's side: its logs, its DNS policy, and which names fail.

bash
kubectl logs -n my-namespace my-client --tail=30
kubectl get pod my-client -n my-namespace -o jsonpath='{.spec.dnsPolicy}{" "}{.spec.dnsConfig}{" node="}{.spec.nodeName}{"\n"}'
kubectl get service my-app -n my-namespace

5. Look a name up from the client, if its image has nslookup or dig: a Service name, an external name, and the failing one. Try a fully qualified name with a trailing dot to skip the search list.

Ask first: the agent runs this only after the user approves it.

bash
kubectl exec my-client -n my-namespace -- nslookup kubernetes.default.svc.cluster.local
kubectl exec my-client -n my-namespace -- nslookup my-app.my-namespace.svc.cluster.local
kubectl exec my-client -n my-namespace -- nslookup example.com.
kubectl exec my-client -n my-namespace -- cat /etc/resolv.conf
# Undo: none needed; these commands only read

6. Open the matching reference and follow its steps:

What you seeReference
A crash, Error during parsing, reload failed, a loop, Plugins not ready, upstream timeouts, SERVFAIL, REFUSED, stub domains, rewrite, hosts, metricsreferences/corefile-and-plugins.md
Slow or intermittent lookups, ndots, NodeLocal DNSCache, scaling, AKS, EKS and GKEreferences/clients-nodelocal-managed.md

Read the results

What the common findings mean (CoreDNS 1.14):

  • A new pod crashes with /etc/coredns/Corefile:<line> - Error during parsing: Unknown directive '<word>' (no [FATAL] prefix; read it with --previous): the Corefile has a typo or a plugin this build does not have, on that line. Pods that were already running log [ERROR] plugin/reload: Corefile changed but reload failed: ... and keep serving their old configuration, so DNS still works until those pods are replaced: the ConfigMap and what is served are no longer the same.
  • [FATAL] plugin/loop: Loop (127.0.0.1:<port> -> :53) detected for zone ".": CoreDNS forwards to itself, usually because the node's /etc/resolv.conf points at a local resolver such as 127.0.0.53 (systemd-resolved), or forward names a loopback address or the kube-dns Service.
  • [ERROR] plugin/errors: 2 <name> A: read udp <pod>-><upstream>:53: i/o timeout: 2 is SERVFAIL; the upstream in forward does not answer (wrong address, firewall, upstream down). The client sees ;; connection timed out; no servers could be reached or SERVFAIL for external names, while Service names, which CoreDNS answers itself, still resolve.
  • One name or domain gets NXDOMAIN and nothing is logged: CoreDNS answered it on purpose: a rewrite to a name that does not exist, a hosts block without fallthrough, a server block for that zone forwarding to the wrong place, or a name under cluster.local that is not a Service (the kubernetes plugin never forwards those).
  • [INFO] plugin/ready: Plugins not ready: "kubernetes" and the pod not Ready: CoreDNS cannot list Services and EndpointSlices from the API server (RBAC, network to the API server, an overloaded API server).
  • 5 <name> A: concurrent queries exceeded maximum 1000 and REFUSED at the client: more queries are waiting on the upstream than max_concurrent allows; the upstream is slow or the load is too high.

State the cause in one sentence, then the evidence you saw (the log line, the Corefile line, the client's result), then the proposed fix.

Proposed fix

Show each fix to the user before running it: what it changes and how to undo it. The Corefile serves every pod in the cluster: never change it yourself; hand it to the user as a proposed fix, with the whole corrected Corefile and the current one saved for the undo. On AKS change the coredns-custom ConfigMap instead, on EKS the add-on's configurationValues, on GKE the kube-dns ConfigMap: the provider overwrites direct edits of the coredns ConfigMap.

Save the Corefile before any change:

bash
kubectl get configmap coredns -n kube-system -o jsonpath='{.data.Corefile}'

Apply the corrected Corefile (save it as Corefile). Running pods reload it within about two minutes (up to a minute for the kubelet to update the mounted ConfigMap, then the reload plugin's check every 30 seconds or so), and log [INFO] Reloading complete:

Proposed fix: review before running. The agent does not run this.

bash
kubectl create configmap coredns -n kube-system --from-file=Corefile --dry-run=client -o yaml | kubectl apply -f -
# Undo: the same command with the Corefile you saved before the change

Once the Corefile is valid again, pods in CrashLoopBackOff start at their next restart, and a stuck rollout goes on by itself. To replace pods that still run an old configuration:

Ask first: the agent runs this only after the user approves it.

bash
kubectl rollout restart deployment/coredns -n kube-system
# Undo: none needed; the restart only recreates the pods with the same template

Restart CoreDNS only after its Corefile is valid: with a broken Corefile, the new pods crash and only the old ones that the rollout has not replaced yet keep DNS working.

Sources

Checked against CoreDNS 1.14.6 (the version kubeadm 1.37 deploys) and Kubernetes 1.37:

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill K8s Coredns Troubleshooting?

Benotzt dës Skill, wann den DNS vum Kubernetes-Cluster selwer Problemer mécht: CoreDNS-Pods sinn am Status CrashLoopBackOff („Error during parsing: Unknown directive“, „plugin/loop: Loop ... detected“), „reload failed“ no enger Ännerung vum Corefile, extern Nimm funktionéieren net, wärend Service-Nimm opgeléist ginn („;; connection timed out; no servers could be reached“, SERVFAIL, „plugin/errors: 2 ... i/o timeout“), eng eenzel Domain oder Stub-Domain funktionéiert net, rewrite- oder hosts-Einträg gräifen net, „Plugins not ready: \"kubernetes\"“, REFUSED oder „concurrent queries exceeded m...

Firwat K8s Coredns Troubleshooting op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. K8s Coredns Troubleshooting besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech K8s Coredns Troubleshooting an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-coredns-troubleshooting an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen K8s Coredns Troubleshooting benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat K8s Coredns Troubleshooting benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir K8s Coredns Troubleshooting domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill K8s Coredns Troubleshooting gratis?

Jo. k8s-servant huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇