Логотип K8s Network Troubleshooting

K8s Network Troubleshooting

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

Використовуйте, коли трафік не доходить до робочого навантаження у Kubernetes, хоча його pod працюють: у Service немає кінцевих точок, неправильний selector або targetPort, з’єднання між pod відхиляються чи перериваються через тайм-аут, DNS-імена не розпізнаються (NXDOMAIN, "server can't find"), NetworkPolicy блокує трафік або маршрут Ingress чи Gateway API не працює. Досліджує проблему за допомогою kubectl get і describe; перед перевірками всередині контейнера запитує дозвіл і пропонує виправлення. Спершу перевіряє ситуацію й запитує дозвіл, перш ніж щось змінювати.

Огляд

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

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

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

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

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

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

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

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

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

Установіть навичку ШІ K8s Network 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-network-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-network-troubleshooting .claude/skills/k8s-network-troubleshooting
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

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

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

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

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

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

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

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

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

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

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

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

Kubernetes network troubleshooting

Find out why traffic does not get from a client to a workload, 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.

Follow the path of a request: the client resolves the Service's name (DNS), connects to the Service's port, the Service forwards to the targetPort of its ready endpoints, and NetworkPolicies on both sides must allow it. Find the first step that fails.

The commands use placeholders: my-namespace and my-app (the target Service and its workload), my-other-namespace and my-web (the client), and my-pod. Replace them with the real names. Never read Secrets. If output contains passwords, tokens or keys, do not repeat them.

When to use

  • A client gets connection refused, time-outs, 502/503, or "no endpoints" when calling a Service, while the target pods are Running.
  • A name does not resolve: NXDOMAIN, "server can't find", "bad address".
  • Traffic stopped after a NetworkPolicy was added, or between namespaces.
  • An Ingress, Gateway or HTTPRoute does not route to its backend.

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:

  • The target pods are not Running or not Ready (crash, probe, image, Pending): k8s-workload-troubleshooting.
  • A node is NotReady, or the network plugin's pods fail on a node: k8s-node-troubleshooting.
  • CoreDNS itself fails (its pods crash, its logs show errors, external names or one domain fail for every client, a Corefile edit): k8s-coredns-troubleshooting.
  • On AKS, a LoadBalancer Service stays <pending> with SyncLoadBalancerFailed, or its IP does not take traffic: k8s-aks-troubleshooting.
  • A GatewayClass, Gateway, listener or route is not Accepted or Programmed (a class waiting for its controller, a route that does not attach, a listener certificate that does not resolve), or the Gateway API CRDs do not match: k8s-gateway-api-troubleshooting.

Investigate

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

1. Check the Service and its endpoints. An EndpointSlice lists the ready pod addresses behind the Service; none means the selector matches no ready pod.

bash
kubectl get service my-app -n my-namespace -o wide
kubectl describe service my-app -n my-namespace
kubectl get endpointslices -n my-namespace -l kubernetes.io/service-name=my-app -o wide

2. Compare the Service with the pods. The selector must match the pod labels, and the targetPort must be a port the container listens on (a number, or a port name from the pod spec).

bash
kubectl get pods -n my-namespace --show-labels -o wide
kubectl get service my-app -n my-namespace -o jsonpath='{.spec.selector}{"\n"}{.spec.ports}{"\n"}'
kubectl get pods -n my-namespace -l app=my-app -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[*].ports}{"\n"}{end}'

Use the Service's real selector in place of app=my-app.

3. Read the client's own errors, in its logs or the user's report. connection refused means something answered and refused (often a wrong port); a time-out means nothing answered (often a NetworkPolicy, or no route); a name error means DNS.

bash
kubectl logs deployment/my-web -n my-other-namespace --tail=50

4. Look for NetworkPolicies on both sides: ingress where the target runs, egress where the client runs.

bash
kubectl get networkpolicy -n my-namespace
kubectl get networkpolicy -n my-other-namespace
kubectl describe networkpolicy -n my-namespace
kubectl get namespace my-other-namespace --show-labels

5. If a name does not resolve, check CoreDNS (it keeps the k8s-app=kube-dns label).

bash
kubectl get pods -n kube-system -l k8s-app=kube-dns
kubectl logs -n kube-system -l k8s-app=kube-dns --tail=50
kubectl get endpointslices -n kube-system -l kubernetes.io/service-name=kube-dns

6. Test from inside the client, when the objects look right but the cause is still open. This runs a program in the user's container, so ask first. It needs wget and nslookup in the image (busybox has both; minimal images often have neither, and the command then fails with "executable file not found"):

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

bash
kubectl exec deployment/my-web -n my-other-namespace -- nslookup my-app.my-namespace
kubectl exec deployment/my-web -n my-other-namespace -- wget -qO- -T 2 http://my-app.my-namespace:80/

To tell a Service problem from a pod problem, call one endpoint's address directly (from step 1) on the target port, the same way.

7. Open the matching reference and follow its steps:

What you seeReference
No endpoints, wrong selector or targetPort, refused connectionsreferences/services.md
NXDOMAIN, "server can't find", "bad address", CoreDNS errorsreferences/dns.md
Time-outs, a NetworkPolicy in either namespacereferences/networkpolicy.md
Ingress, IngressClass, Gateway, HTTPRoutereferences/ingress-gateway.md

Read the results

What the common findings mean (Kubernetes 1.37):

  • No endpoints in the Service's EndpointSlices (or Endpoints: empty in describe service): no Ready pod matches the selector. Either the selector does not match the pod labels, or the matching pods are not Ready.
  • Endpoints with ready: false: the pods match but are not Ready, so they get no traffic (unless the Service sets publishNotReadyAddresses: true). Hand over to k8s-workload-troubleshooting.
  • targetPort defaults to port when it is not set. A Service on port 80 in front of an app on 8080 needs targetPort: 8080. A named targetPort must match a port name the pods actually declare.
  • A short name resolves only in the client's own namespace: the pod's DNS search list starts with its own namespace. From another namespace use my-app.my-namespace or my-app.my-namespace.svc.cluster.local.
  • NetworkPolicy: a pod is open until some policy selects it for a direction; then only what some policy allows gets through. Policies add up; they never deny. A connection needs both the client's egress and the target's ingress to allow it. A policy has no effect without a network plugin that enforces it.
  • An egress policy that isolates the client also blocks DNS unless it allows traffic to the cluster's DNS service.

State the cause in one sentence, then the evidence you saw (the selector and labels, the ports, the policy, the error), then the proposed fix.

Proposed fix

Show each fix to the user before running it: what it changes and how to undo it. Patching a Service's selector or port, or an Ingress or route field, is reversible, so it goes under "Ask first" and runs only after the user says yes. Creating or deleting objects (a NetworkPolicy, a Service) and editing CoreDNS are never run by you: hand them to the user as proposed fixes and say why. Prefer fixing the source the objects are deployed from (manifest, Helm values, GitOps repository) when there is one. Write each undo with the values you found.

Point a Service's selector at the labels the pods really have:

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

bash
kubectl patch service my-app -n my-namespace --type=merge -p '{"spec": {"selector": {"app": "my-app"}}}'
# Undo: kubectl patch service my-app -n my-namespace --type=merge -p '{"spec": {"selector": {"app": "my-app-v1"}}}'

A merge patch on selector replaces only the keys it names; to remove a key, set it to null in the patch.

Send a Service's traffic to the port the container listens on:

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

bash
kubectl patch service my-app -n my-namespace --type=json -p '[{"op": "replace", "path": "/spec/ports/0/targetPort", "value": 80}]'
# Undo: kubectl patch service my-app -n my-namespace --type=json -p '[{"op": "replace", "path": "/spec/ports/0/targetPort", "value": 8080}]'

Allow a client namespace through a NetworkPolicy. This creates a new policy, which can open traffic wider than intended, so a human reviews and applies it: see references/networkpolicy.md.

Sources

Checked against the Kubernetes 1.37 documentation and Gateway API 1.6:

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

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

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

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

Використовуйте, коли трафік не доходить до робочого навантаження у Kubernetes, хоча його pod працюють: у Service немає кінцевих точок, неправильний selector або targetPort, з’єднання між pod відхиляються чи перериваються через тайм-аут, DNS-імена не розпізнаються (NXDOMAIN, "server can't find"), NetworkPolicy блокує трафік або маршрут Ingress чи Gateway API не працює. Досліджує проблему за допомогою kubectl get і describe; перед перевірками всередині контейнера запитує дозвіл і пропонує виправлення. Спершу перевіряє ситуацію й запитує дозвіл, перш ніж щось змінювати.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Усі

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

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