Kubernetes and Cloud Native Associate (KCNA) — Question 170
How to create a headless service?
Answer options
- A. By specifying .spec.ClusterIP: headless
- B. By specifying .spec.clusterIP: None
- C. By specifying .spec.ClusterIP: 0.0.0.0
- D. By specifying .spec.ClusterIP: localhost
Correct answer: B
Explanation
The correct method to create a headless service is by setting .spec.clusterIP to None, which indicates that no cluster IP should be assigned. The other options either do not conform to the required specification or do not correctly indicate the absence of a cluster IP.