Logo: K8s Network Troubleshooting

K8s Network Troubleshooting

Organisatioun
k8s-servant
k8s-network-troubleshooting

Use when traffic does not reach a workload in Kubernetes although its pods are running: a Service with no endpoints, a wrong selector or targetPort, connection refused or time-outs between pods, DNS names that do not resolve (NXDOMAIN, "server can't find"), a NetworkPolicy blocking traffic, or an Ingress or Gateway API route that does not route. Investigates with kubectl get and describe, asks before checks inside a container, and proposes fixes. Reads first and asks before changing anything.

Iwwersiicht

Editeurk8s-servant
Repositoryk8s-skills
Skill-Nummk8s-network-troubleshooting
Stären
36
Forks
7
Matgeliwwert Dateien
4
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.

  • 4 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 Network 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-network-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-network-troubleshooting .claude/skills/k8s-network-troubleshooting
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert K8s Network 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 Network 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 Network 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.

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:

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 Network Troubleshooting?

Use when traffic does not reach a workload in Kubernetes although its pods are running: a Service with no endpoints, a wrong selector or targetPort, connection refused or time-outs between pods, DNS names that do not resolve (NXDOMAIN, "server can't find"), a NetworkPolicy blocking traffic, or an Ingress or Gateway API route that does not route. Investigates with kubectl get and describe, asks before checks inside a container, and proposes fixes. Reads first and asks before changing anything.

Firwat K8s Network Troubleshooting op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. K8s Network 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 Network 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-network-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 Network 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 Network Troubleshooting benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir K8s Network 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 Network 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 👇