What is the effect of setting spec.clusterIP: None in a Service YAML?

Study for the Kubernetes Cloud Native Associate (KCNA) Certification. Prepare with flashcards and multiple choice questions. Ensure success with detailed explanations. Ready for your exam!

Multiple Choice

What is the effect of setting spec.clusterIP: None in a Service YAML?

Explanation:
Setting spec.clusterIP to None creates a headless service. Without a cluster IP, Kubernetes does not allocate a virtual IP or route traffic through a proxy load balancer. Instead, the service DNS resolves to the actual endpoints (the pods) backing the service, so clients can connect directly to each pod. This is especially useful for StatefulSets or when you need direct access to individual pods or to rely on the full list of endpoints for your discovery logic. It differs from a regular service that provides a stable cluster IP and does load balancing behind the scenes. It doesn’t by itself expose an external IP, nor does it modify node hosts files; DNS in the cluster handles the endpoint resolution.

Setting spec.clusterIP to None creates a headless service. Without a cluster IP, Kubernetes does not allocate a virtual IP or route traffic through a proxy load balancer. Instead, the service DNS resolves to the actual endpoints (the pods) backing the service, so clients can connect directly to each pod. This is especially useful for StatefulSets or when you need direct access to individual pods or to rely on the full list of endpoints for your discovery logic. It differs from a regular service that provides a stable cluster IP and does load balancing behind the scenes. It doesn’t by itself expose an external IP, nor does it modify node hosts files; DNS in the cluster handles the endpoint resolution.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy