nerdexam
Linux_Foundation

KCNA · Question #46

How to create a headless service?

The correct answer is B. By specifying .spec.clusterIP: None. A headless service in Kubernetes is created by explicitly setting its spec.clusterIP field to None.

Submitted by thandi_sa· May 4, 2026Kubernetes Fundamentals

Question

How to create a headless service?

Options

  • ABy specifying .spec.ClusterIP: headless
  • BBy specifying .spec.clusterIP: None
  • CBy specifying
  • DBy specifying .spec.ClusterIP: localhost

How the community answered

(23 responses)
  • A
    4% (1)
  • B
    91% (21)
  • C
    4% (1)

Why each option

A headless service in Kubernetes is created by explicitly setting its `spec.clusterIP` field to `None`.

ABy specifying .spec.ClusterIP: headless

Specifying `.spec.ClusterIP: headless` is not a valid configuration; the correct value to make a service headless is `None` for the `clusterIP` field.

BBy specifying .spec.clusterIP: NoneCorrect

Setting `spec.clusterIP: None` explicitly tells Kubernetes not to allocate a ClusterIP address for the service, making it a headless service; this allows direct access to the Pods backing the service via their individual IP addresses through DNS lookups rather than a single service IP.

CBy specifying
DBy specifying .spec.ClusterIP: localhost

Specifying `.spec.ClusterIP: localhost` is not a valid configuration for creating a headless service; `None` is the correct value.

Concept tested: Kubernetes Headless Service configuration

Source: https://kubernetes.io/docs/concepts/services-networking/service/#headless-services

Topics

#Kubernetes Services#Headless Services#Service Discovery

Community Discussion

No community discussion yet for this question.

Full KCNA Practice