liveBook · Manning

Headless service

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A headless service is a Kubernetes Service configured without a cluster IP so DNS can return the addresses of its backing pods directly.

Configure a Kubernetes Service with clusterIP: None to remove its virtual cluster IP. DNS then returns the internal addresses of all selected Pods, allowing clients to communicate with Pods directly. section 6.4.1

Configure and verify a headless Service

Add clusterIP: None beneath spec in the Service YAML, then run kubectl create -f svc.yaml. Verify the result with kubectl get svc: the Service shows CLUSTER-IP None while retaining its configured ports, such as 8080/TCP and 9200/TCP. section 6.4.1

Use direct Pod addressing when clients must distinguish replicas, such as a database cluster with one writable copy and read-only copies. StatefulSets create a headless Service automatically. section 6.4.1

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains the clusterIP: None setting, DNS behavior, database rationale, YAML configuration, and kubectl verification.
Examples
Uses a multiport internal-svc with ports 8080 and 9200, plus database replicas with separate write and read roles.
What it assumes
Assumes familiarity with Kubernetes Services, Pods, selectors, ports, and DNS-based service lookup.
What you can do after
Operate/configure a headless Service with YAML, create it using kubectl, and verify its absent cluster IP.
How it connects
Connects Kubernetes Services with DNS, Pods, database clusters, and StatefulSets.

Also explained in

Compare how 2 books explain headless service →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.