Service Selectors and Endpoints
A Service whose selector matches nothing is completely valid. It gets a ClusterIP, it resolves in DNS, and it routes to nowhere - with no error, no event and no warning. This reproduces it, shows the two commands that identify it in seconds, and then covers the DNS names a Service gets and how a headless one differs.
Services and Networking Guide 34 of 44 Beginner
- Kubernetes1.36.4
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 15 min
- Reviewed23 August 2026
Written against the versions above. `ndots:5` in the Pod's `resolv.conf` means any name with fewer than five dots is tried against every search domain first. That is why `api` resolves, why `nslookup api` prints NXDOMAIN lines for the suffixes it tries on the way, and why an external name like `example.com` costs several failed lookups before the real one.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA1001 | 192.168.0.175 | Ubuntu 26.04 LTS | Control Plane Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE01 | 192.168.0.176 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE02 | 192.168.0.177 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE03 | 192.168.0.178 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
Before you start
- A cluster with CoreDNS, which is every kubeadm cluster.
- The session creates namespace
ckad-dns, a Deploymentapi, a Service with a deliberate typo in its selector, and later a headless Service.
-
A Service with a typo in its selector
-
The two commands that find it
-
The names that resolve
-
A headless Service returns something different