EndpointSlice & Service Discovery Debug Prompt
Debug Services that route to no pods or stale pods — empty EndpointSlices, failing readiness gates, selector mismatches, and headless/StatefulSet DNS resolution.
- Target user
- Engineers debugging why a Service isn't routing to healthy pods
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Kubernetes networking engineer who has debugged every reason a Service silently routes to nothing. I will provide: - The `Service` spec (selector, ports, type, `publishNotReadyAddresses`) - The target pods (labels, readiness probe, status) - Output of `kubectl get endpointslices -l kubernetes.io/service-name=<svc>` and `kubectl describe svc` - Symptoms (connection refused, intermittent 503s, DNS NXDOMAIN, traffic to dead pods) - Whether it's a normal, headless, or StatefulSet-backed Service Diagnose in this order: 1. **Selector vs labels** — confirm the Service selector actually matches pod labels exactly (a single typo or extra label breaks it). Show the `kubectl get pods -l <selector>` command that proves which pods the Service claims. 2. **EndpointSlice contents** — read the EndpointSlice: are addresses present? Check the `conditions` (ready / serving / terminating) per endpoint. Teach me to distinguish "no pods matched" from "pods matched but not Ready". 3. **Readiness gates** — if endpoints exist but show `ready: false`, trace the readiness probe; explain how a failing probe pulls a pod out of rotation and when `publishNotReadyAddresses` is appropriate. 4. **Port mapping** — verify `targetPort` resolves to a real containerPort or named port; named-port mismatches produce empty or wrong endpoints. 5. **Headless / StatefulSet DNS** — for `clusterIP: None`, explain per-pod A records (`pod-0.svc.ns.svc.cluster.local`), why a not-Ready pod is absent from DNS, and the `publishNotReadyAddresses` trade-off for clustered apps that need peers during startup. 6. **kube-proxy / dataplane** — when EndpointSlices look correct but traffic still fails: stale conntrack, kube-proxy/iptables vs IPVS, or a CNI issue. Give the commands to confirm the dataplane programmed the endpoints. 7. **Topology routing** — if using `trafficDistribution`/topology-aware hints, explain how zone routing can starve a Service of endpoints in one zone. Output as: (a) one-sentence root cause, (b) the ordered diagnostic commands, (c) the corrected manifest or label fix, (d) a verification (curl the ClusterIP, dig the DNS name), (e) one alert that would have caught zero-ready-endpoints sooner. Be precise about which layer (selector, readiness, DNS, dataplane) each symptom points to.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Pod DNS ndots and Search Domain Latency Tuning Prompt
Cut DNS latency and failed lookups caused by the default ndots:5 and long search-domain lists — decide when to override dnsConfig, use FQDNs with a trailing dot, or keep cluster defaults.
-
Ingress-NGINX Rate Limiting & Hardening Prompt
Design per-route rate limiting, connection limits, and abuse controls on ingress-nginx using annotations — including the memcached shared-state caveat, whitelist CIDRs, and how limits interact across replicas.
-
Kubernetes Service Traffic Policy Routing Design Prompt
Design Service internalTrafficPolicy and externalTrafficPolicy settings to keep traffic node-local for latency or preserve client source IP — without silently blackholing traffic when no local endpoint exists.
-
NetworkPolicy Default-Deny Baseline Design Prompt
Author a zero-trust NetworkPolicy baseline for a cluster — default-deny ingress and egress per namespace, explicit allow rules for DNS and platform traffic, and a safe rollout that won't black-hole production.
More Kubernetes & Helm prompts & error guides
Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.