KCNA · Question #202
Which of the following workload require a headless service while deploying into the namespace?
The correct answer is A. StatefulSet. Headless services are typically required for StatefulSets to provide stable network identities and DNS resolution for individual pods within the set.
Question
Which of the following workload require a headless service while deploying into the namespace?
Options
- AStatefulSet
- BCronJob
- CDeployment
- DDaemonSet
How the community answered
(38 responses)- A89% (34)
- B3% (1)
- C3% (1)
- D5% (2)
Why each option
Headless services are typically required for StatefulSets to provide stable network identities and DNS resolution for individual pods within the set.
StatefulSets require stable, unique network identifiers for each Pod, which a headless service (clusterIP: None) provides by allowing direct DNS lookup for individual Pod hostnames (e.g., <pod-name>.<service-name>.<namespace>.svc.cluster.local). This is crucial for applications that manage state and need persistent identities.
CronJobs are designed for scheduled tasks and do not typically require stable network identities for individual pods, as their pods are ephemeral and complete discrete tasks.
Deployments manage stateless applications and use regular services for load balancing and discovery, where pods are interchangeable and do not require stable individual network identities.
DaemonSets ensure a pod runs on every node and typically use standard services or direct node access for communication, not requiring stable individual pod network identities.
Concept tested: Headless services with StatefulSets
Source: https://kubernetes.io/docs/concepts/services-networking/service/#headless-services
Topics
Community Discussion
No community discussion yet for this question.