To achieve consistent DNS naming for StatefulSet pods, what resource should you use?

Study for the Kubernetes Certified Network Administrator Exam. Our test offers comprehensive flashcards, multiple-choice questions, and detailed explanations. Be confident for your exam!

Multiple Choice

To achieve consistent DNS naming for StatefulSet pods, what resource should you use?

Explanation:
Using a headless service. By setting a service to be headless (clusterIP: None), Kubernetes does not allocate a single cluster IP and instead creates DNS records for each backing pod. This yields stable, per-pod DNS names such as <statefulset-name>-<ordinal>.<service-name>.<namespace>.svc.cluster.local, allowing clients to address each StatefulSet pod directly by its fixed name. Other service types expose one IP or forward to an external name and do not provide per-pod DNS entries, so they aren’t suitable for achieving consistent DNS naming for StatefulSet pods.

Using a headless service. By setting a service to be headless (clusterIP: None), Kubernetes does not allocate a single cluster IP and instead creates DNS records for each backing pod. This yields stable, per-pod DNS names such as -...svc.cluster.local, allowing clients to address each StatefulSet pod directly by its fixed name. Other service types expose one IP or forward to an external name and do not provide per-pod DNS entries, so they aren’t suitable for achieving consistent DNS naming for StatefulSet pods.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy