‹ All CKA questions

CKA Practice Question 5: Headless Service Stable DNS

Certified Kubernetes Administrator (CKA) · Test 1 · question 5 of 10

Services & Networkingeasy

You are deploying a 3-replica StatefulSet running a database that replicates between its members. Each member must be individually addressable by a stable DNS name so peers can connect directly to a specific replica rather than being load-balanced across all of them.

Which Service configuration should you use?

Select one answer
Show answer and explanation

Answer:

  • B. A headless Service, created by setting clusterIP: None in the Service spec

Setting clusterIP: None makes the Service headless. No virtual IP is allocated and no load-balancing is performed; instead, cluster DNS returns the pod IPs directly. Paired with a StatefulSet, this gives every replica a predictable per-pod DNS name of the form <pod-name>.<service-name>.<namespace>.svc.cluster.local, which is exactly what peer-to-peer replication needs.

Option A does the opposite of what is required. A ClusterIP Service allocates one virtual IP and distributes connections across all ready endpoints, so a client cannot choose which replica it reaches.

Option C exposes the Service on a port on every node for external access. It still load-balances across all backing pods, so it does not make individual replicas addressable, and it needlessly exposes an internal database outside the cluster.

Option D is for aliasing a name to an external DNS record outside the cluster. It has no pod selector and no endpoints, so it cannot address StatefulSet members at all.

Reference: Headless Services

Practice Test 1 ›

Study guides for CKA