Question 6
Domain 4: StorageWhich Kubernetes resource combination is required to deploy a 3-replica StatefulSet with stable pod DNS names and one 10Gi persistent volume claim per pod, exposed through a headless Service on port 5432?
Correct answer: A
Explanation
A StatefulSet provides stable network identity and ordered pod management, and its "volumeClaimTemplates" create one persistent volume claim per replica. A headless Service with "clusterIP: None" gives each pod stable DNS names and can expose port 5432 without load balancing, which matches the required 3-replica PostgreSQL-style deployment.
Why each option is right or wrong
A. A StatefulSet with volumeClaimTemplates and a headless Service (clusterIP: None) exposing port 5432
Under the Kubernetes StatefulSet API, `volumeClaimTemplates` is the mechanism that creates a distinct PersistentVolumeClaim for each replica, so a 3-replica set yields 3 separate 10Gi claims rather than one shared volume. The Service must be headless (`clusterIP: None`) to publish per-pod DNS records for the StatefulSet’s stable identities, and port 5432 is simply the Service port exposed to those pods; this combination matches the required ordered, stateful deployment model in the StatefulSet and Service specs.
B. A Deployment with a ClusterIP Service and a single PersistentVolumeClaim shared by all replicas
C. A DaemonSet with a NodePort Service and separate PersistentVolumes created manually for each node
D. A ReplicaSet with an ExternalName Service and an emptyDir volume for each pod