Skip to content

Commit efd1306

Browse files
authored
Merge pull request #45744 from tamilselvan1102/k8s-20240401
Explanation about headless service
2 parents fb0089e + 83af5ac commit efd1306

File tree

2 files changed

+15
-4
lines changed
  • content/en/docs

2 files changed

+15
-4
lines changed

content/en/docs/concepts/services-networking/service.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -855,9 +855,19 @@ You can use a headless Service to interface with other service discovery mechani
855855
without being tied to Kubernetes' implementation.
856856

857857
For headless Services, a cluster IP is not allocated, kube-proxy does not handle
858-
these Services, and there is no load balancing or proxying done by the platform
859-
for them. How DNS is automatically configured depends on whether the Service has
860-
selectors defined:
858+
these Services, and there is no load balancing or proxying done by the platform for them.
859+
860+
A headless Service allows a client to connect to whichever Pod it prefers, directly. Services that are headless don't
861+
configure routes and packet forwarding using
862+
[virtual IP addresses and proxies](/docs/reference/networking/virtual-ips/); instead, headless Services report the
863+
endpoint IP addresses of the individual pods via internal DNS records, served through the cluster's
864+
[DNS service](/docs/concepts/services-networking/dns-pod-service/).
865+
To define a headless Service, you make a Service with `.spec.type` set to ClusterIP (which is also the default for `type`),
866+
and you additionally set `.spec.clusterIP` to None.
867+
868+
The string value None is a special case and is not the same as leaving the `.spec.clusterIP` field unset.
869+
870+
How DNS is automatically configured depends on whether the Service has selectors defined:
861871

862872
### With selectors
863873

content/en/docs/reference/labels-annotations-taints/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,10 @@ Type: Label
10011001

10021002
Example: `service.kubernetes.io/headless: ""`
10031003

1004-
Used on: Service
1004+
Used on: Endpoints
10051005

10061006
The control plane adds this label to an Endpoints object when the owning Service is headless.
1007+
To learn more, read [Headless Services](/docs/concepts/services-networking/service/#headless-services).
10071008

10081009
### service.kubernetes.io/topology-aware-hints (deprecated) {#servicekubernetesiotopology-aware-hints}
10091010

0 commit comments

Comments
 (0)