service-debug
Skill235 starsChanged 6 months agoApache-2.0View on GitHub
Diagnose Service connectivity issues (empty Endpoints, selector mismatch, port mismatch, no backend pods). Checks Service, Endpoints, and target pods to identify why traffic is not reaching backends.
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- kbc/CLAUDE.mdCLAUDE.md
- cluster-eventsSkill
- deployment-rollout-debugSkill
- dns-debugSkill
- gateway-diagnosticsSkill
- hpa-debugSkill
- http-log-statsSkill
- image-pull-debugSkill
- ingress-debugSkill
- job-debugSkill
- networkpolicy-debugSkill
- node-health-checkSkill
- node-logsSkill
- pod-crash-debugSkill
- pod-pending-debugSkill
- pvc-debugSkill
- quota-debugSkill
- statefulset-debugSkill
- volcano-diagnose-podSkill
- volcano-gang-schedulingSkill
- volcano-job-diagnoseSkill
- volcano-node-resourcesSkill
- volcano-queue-diagnoseSkill
- volcano-resource-insufficientSkill
- volcano-scheduler-configSkill
- volcano-scheduler-logsSkill
- manage-skillSkill
- skill-authoringSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
When a Service is unreachable, returns connection refused, or has no backends, follow this flow to identify the root cause.
- Very specific: line 34
If ENDPOINTS column shows <none> or is empty, no pods match the Service's selector — go to step 3.
- Distinctive: line 35
If endpoints exist, note the IPs and ports — go to step 4.
- Distinctive: line 61
If no pods match:
- Very specific: line 66
If pods exist but none are Ready:
- Very specific: line 68
Use pod-crash-debug or check readiness probes
- Distinctive: line 72
Verify that the Service port, targetPort, and the container's actual listening port all align.
- Distinctive: line 110
Check the application logs:
- Very specific: line 126
Verify the external name resolves from within the cluster (see dns-debug skill).
- Very specific: line 144
If EXTERNAL-IP shows <pending>, the cloud load balancer provisioner may have failed:
- Distinctive: line 150
Check events for errors from the cloud controller manager.
- Very specific: line 158
If clients are getting connection refused, verify the individual pod IPs are correct and the pods are ready.
- Distinctive: line 164
If the cluster uses a service mesh (Istio, Linkerd), traffic routing may be controlled by the mesh — check the mesh's VirtualService or …
- Very specific: line 165
If endpoints exist and ports match but connections still time out, a NetworkPolicy may be blocking traffic — use networkpolicy-debug to …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Service Connectivity Diagnosis
When a Service is unreachable, returns connection refused, or has no backends, follow this flow to identify the root cause.
Scope: This skill is for diagnosis only. Once you identify the root cause, report it to the user and stop. Do NOT attempt to modify the Service, Endpoints, or pod specs — that should be left to the user.
Diagnostic Flow
1. Check the Service
kubectl get svc <service> -n <ns> -o wideConfirm the Service exists and note:
- TYPE — ClusterIP, NodePort, LoadBalancer, or ExternalName
- CLUSTER-IP — should not be
Noneunless it is a headless service - PORT(S) — the port(s) the Service exposes
- SELECTOR — the label selector used to find backend pods
2. Check Endpoints
kubectl get endpoints <service> -n <ns>- If
ENDPOINTScolumn shows<none>or is empty, no pods match the Service's selector — go to step 3. - If endpoints exist, note the IPs and ports — go to step 4.
For more detail (including notReadyAddresses):
kubectl describe endpoints <service> -n <ns>3. Investigate selector and pods
The Service's selector must match labels on running, ready pods.
Get the Service selector:
kubectl get svc <service> -n <ns> -o jsonpath='{.spec.selector}'List pods that match the selector:
kubectl get pods -n <ns> -l <key>=<value> -o wide(Replace <key>=<value> with each selector pair from the previous command.)
If no pods match:
- The selector may be wrong (typo, outdated label)
- The pods may be in a different namespace
- The pods may not exist yet
If pods exist but none are Ready:
- Pods may be starting, crashing, or failing readiness probes
- Use
pod-crash-debugor check readiness probes
4. Check port configuration
Verify that the Service port, targetPort, and the container's actual listening port all align.
kubectl get svc <service> -n <ns> -o jsonpath='{range .spec.ports[*]}port={.port} targetPort={.targetPort} protocol={.protocol}{"\n"}{end}'kubectl get pod <backend-pod> -n <ns> -o jsonpath='{range .spec.containers[*].ports[*]}containerPort={.containerPort} protocol={.protocol}{"\n"}{end}'The Service's targetPort must match one of the container's containerPort values (or the named port). If they don't match, traffic will be sent to the wrong port.
Note: if the container does not declare containerPort, the traffic may still work — containerPort is informational. The real check is whether the application is actually listening on the targetPort.
5. Match patterns and conclude
Endpoints empty — No pods match selector
The Service has no endpoints because no running, ready pods match its label selector.
Possible causes:
- Selector mismatch — the Service selector labels don't match the pod labels (typo or outdated after a rename)
- No pods exist — the backing Deployment/StatefulSet has 0 replicas or hasn't been created
- Pods not ready — pods exist but are failing readiness probes, so they are excluded from Endpoints
Advise the user to compare the Service selector with the pod labels and ensure pods are running and ready.
Connection refused — Port mismatch or application not listening
Endpoints exist, but connections to the Service are refused.
- The Service
targetPortmay not match the port the application is actually listening on - The application may not have started yet or may have crashed
Check the application logs:
kubectl logs <backend-pod> -n <ns> --tail=50Service type ExternalName not resolving — DNS-based service issue
ExternalName services return a CNAME record. If the target hostname is unreachable or doesn't resolve, the service will appear broken.
kubectl get svc <service> -n <ns> -o jsonpath='{.spec.externalName}'Verify the external name resolves from within the cluster (see dns-debug skill).
NodePort / LoadBalancer not reachable from outside — External access issue
For NodePort: verify the node's firewall allows the allocated port.
kubectl get svc <service> -n <ns> -o jsonpath='{.spec.ports[*].nodePort}'For LoadBalancer: check the external IP assignment.
kubectl get svc <service> -n <ns>If EXTERNAL-IP shows <pending>, the cloud load balancer provisioner may have failed:
kubectl describe svc <service> -n <ns>Check events for errors from the cloud controller manager.
Headless Service (ClusterIP: None) — Expected behavior
Headless services do not get a cluster IP. DNS returns the individual pod IPs directly. This is by design for StatefulSets and services that need direct pod addressing.
If clients are getting connection refused, verify the individual pod IPs are correct and the pods are ready.
Notes
- For services using
sessionAffinity: ClientIP, connections from the same source IP are routed to the same pod — if that pod becomes unhealthy, the session sticks to it until the timeout. EndpointSlices(default in K8s 1.21+) replace Endpoints for large-scale services. You can check them with:kubectl get endpointslices -n <ns> -l kubernetes.io/service-name=<service>.- If the cluster uses a service mesh (Istio, Linkerd), traffic routing may be controlled by the mesh — check the mesh's VirtualService or ServiceProfile resources.
- If endpoints exist and ports match but connections still time out, a NetworkPolicy may be blocking traffic — use
networkpolicy-debugto check.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

