Certified Kubernetes Application Developer (CKAD) Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Enhance your skills for the CKAD exam. Study with curated quizzes and detailed explanations. Prepare effectively for your success!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


To associate a stateful set with a headless service, which property should be set in the stateful set spec?

  1. hostname property

  2. serviceName property

  3. volumeClaimTemplate property

  4. subdomain property

The correct answer is: serviceName property

The stateful set specification requires the serviceName property to be set when associating it with a headless service. This property indicates which service will be used for the stateful set's associated pods, enabling the stateful set to seamlessly integrate with the service. In Kubernetes, a headless service is defined by setting the ClusterIP field to "None", which allows the DNS system to create individual A records for each pod associated with the stateful set. By specifying the serviceName in the stateful set, you ensure that the pods can be reached using their DNS names, which follow the pattern `<pod-name>.<service-name>`. This is fundamental for stateful applications that rely on stable network identities. Although other properties such as hostname or volumeClaimTemplate are important in their contexts, they do not directly contribute to the association with a headless service in the way that serviceName does. The subdomain property could be involved in filtering DNS records, but it is secondary to the explicit connection provided by setting the serviceName. Therefore, the correct focus on serviceName marks the definitive link between the stateful set and its service.