Kubernetes / Services, DNS & Traffic Routing
Understand headless Service DNS before expecting a virtual IP
A headless Service is designed to expose endpoint discovery rather than an ordinary cluster virtual IP. Inspect its definition and endpoints.
Environment and inputs: Kubernetes · kubectl with supported client/server versions and delegated RBAC. Examples use namespace app unless noted. Check context, namespace, APIs and provider support first.
Start with this check
Check which system and tools you are using. Replace example objects, namespaces, images, file paths and hosts with approved values. Remove sensitive information before sharing output. Follow the application owner’s process for changes.
kubectl -n app get service database -o jsonpath='{.spec.clusterIP}{" "}{.spec.selector}'
kubectl -n app get endpointslices -l kubernetes.io/service-name=database
What the results mean
A clusterIP of None identifies headless intent. Returned discovery records depend on endpoint readiness and relevant Service configuration.
Fix the cause and check again
Compare the application's discovery contract with StatefulSet identity and actual DNS answers. Fix endpoint or client expectations rather than assigning a random IP.
Before changing production
Do not replace a headless Service with a regular one without reviewing persistent peer-discovery requirements.