Kubernetes Headless & ExternalName Service Design Prompt
Design the right Service type for stateful peer discovery, external database aliasing, and direct-pod addressing, choosing between headless (clusterIP: None) and ExternalName Services.
- Target user
- Engineers wiring up StatefulSets and external dependencies
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior Kubernetes networking engineer who has debugged stateful clusters that broke because someone put a load-balancing ClusterIP in front of peers that needed stable per-pod DNS. I will provide: - The workload (StatefulSet, external DB, third-party API) and how clients address it - Whether clients need stable per-replica identity or just any healthy backend - Cross-namespace or out-of-cluster targets Your job: 1. **Pick the Service type** — decide between ClusterIP, headless (`clusterIP: None`), and ExternalName, and justify it. Headless returns A records for every ready pod; ExternalName returns a CNAME with no proxying. 2. **Headless + StatefulSet** — wire `serviceName` so each pod gets `pod-0.svc.ns.svc.cluster.local`. Explain how peers (etcd, Kafka, Cassandra) use these stable names for membership and why a normal Service would randomize connections. 3. **publishNotReadyAddresses** — decide whether peers must discover not-yet-ready pods during bootstrap, and set the flag accordingly. 4. **ExternalName for external deps** — alias an RDS endpoint or SaaS host so in-cluster clients use a stable internal name; note that TLS SNI and ports are not rewritten, so certificate hostname mismatches can bite. 5. **EndpointSlice reality** — explain how `kubectl get endpointslices` reflects each design and how to confirm DNS with `nslookup` from a debug pod. 6. **Failure modes** — call out: headless with a selector that matches nothing, ExternalName pointing at an HTTP target behind an ingress, and clients caching DNS too long. Output as: (a) the chosen Service manifest(s), (b) the resulting DNS records clients will see, (c) a verification checklist using kubectl and nslookup, (d) the top 3 misconfigurations for this case. Do not front a peer-discovery StatefulSet with a load-balancing ClusterIP — verify with nslookup before declaring it working.
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.
-
Kubernetes CoreDNS Debugging Prompt
Diagnose Kubernetes DNS issues — CoreDNS not resolving, ndots traps, search domain explosion, NXDOMAIN floods, conntrack DNS races.
-
Helm Chart.lock Dependency Drift Reconciliation Prompt
Resolve Chart.yaml vs Chart.lock dependency drift and 'found in Chart.yaml, but missing in charts/ directory' failures by reasoning about version ranges, the lock digest, and helm dependency build vs update.
-
Helm Release History Pruning and max-history Prompt
Stop Helm release history from bloating etcd with hundreds of Secret/ConfigMap revisions — set --history-max, prune safely, and avoid hitting the 1MB Secret size limit or slow upgrades.
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.