Логотип K8s Coredns Troubleshooting

K8s Coredns Troubleshooting

Організація
k8s-servant
k8s-coredns-troubleshooting

Використовуйте, коли DNS кластера Kubernetes працює некоректно: поди CoreDNS переходять у стан CrashLoopBackOff ("Error during parsing: Unknown directive", "plugin/loop: Loop ... detected"); після редагування Corefile з’являється "reload failed"; зовнішні доменні імена не резолвляться, хоча імена Service працюють (";; connection timed out; no servers could be reached", SERVFAIL, "plugin/errors: 2 ... i/o timeout"); не працює один домен або stub-домен; не працюють записи rewrite або hosts; з’являється "Plugins not ready: \"kubernetes\""; виникає REFUSED або "concurrent queries exceeded maximum"; запити DNS повільні (ndots, затримки по 5 с); проблеми пов’язані з NodeLocal DNSCache (169.254.20.10) або ConfigMaps AKS coredns-custom, доповнення EKS чи GKE kube-dns. Агент проводить діагностику за допомогою kubectl get і журналів та пропонує виправлення. Спочатку лише аналізує, а перед будь-якими змінами запитує дозвіл.

Огляд

Видавецьk8s-servant
Репозиторійk8s-skills
Назва навичкиk8s-coredns-troubleshooting
Зірки
36
Форки
7
Файли в пакеті
2
ЛіцензіяApache-2.0
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 2

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Видавець на GitHub: k8s-servant. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ K8s Coredns Troubleshooting у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-coredns-troubleshooting
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

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
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку K8s Coredns Troubleshooting в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку K8s Coredns Troubleshooting, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка K8s Coredns Troubleshooting не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

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:

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ K8s Coredns Troubleshooting?

Використовуйте, коли DNS кластера Kubernetes працює некоректно: поди CoreDNS переходять у стан CrashLoopBackOff ("Error during parsing: Unknown directive", "plugin/loop: Loop ... detected"); після редагування Corefile з’являється "reload failed"; зовнішні доменні імена не резолвляться, хоча імена Service працюють (";; connection timed out; no servers could be reached", SERVFAIL, "plugin/errors: 2 ... i/o timeout"); не працює один домен або stub-домен; не працюють записи rewrite або hosts; з’являється "Plugins not ready: \"kubernetes\""; виникає REFUSED або "concurrent queries exceeded maxim...

Навіщо використовувати K8s Coredns Troubleshooting у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. K8s Coredns Troubleshooting — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити K8s Coredns Troubleshooting у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-coredns-troubleshooting. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати K8s Coredns Troubleshooting?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати K8s Coredns Troubleshooting?

Зі скількома забажаєте. У TypingMind ви можете використовувати K8s Coredns Troubleshooting із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ K8s Coredns Troubleshooting?

Так. На GitHub цю навичку публікує k8s-servant за ліцензією Apache-2.0. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇