Courseiva
mediumMultiple ChoiceObjective-mapped

Google ACE Practice Question: A distributed database running on GKE requires…

A distributed database running on GKE requires stable, persistent hostnames (pod-0, pod-1, pod-2) and ordered startup/shutdown for proper cluster initialization. Pods must retain their identity across restarts. Which Kubernetes resource is designed for this?

⚠ Common exam trap

Google Cloud often tests the misconception that a Deployment with a fixed number of replicas can provide stable identities, but Deployments treat pods as interchangeable and do not preserve hostnames or startup order, making StatefulSet the only correct choice for stateful workloads requiring persistent identity.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

StatefulSet with a headless Service

StatefulSet is the correct resource because it provides stable, unique network identifiers (e.g., pod-0, pod-1, pod-2) via a headless Service, ordered startup and shutdown (pod-0 starts first, pod-2 terminates first), and persistent pod identity that survives restarts. These features are essential for distributed databases like Cassandra or ZooKeeper that require consistent hostnames and initialization order.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Deployment with pod affinity rules

    Why it's wrong here

    Deployments manage stateless Pods with randomly generated names and temporary IPs. Adding pod affinity rules only influences scheduling placement or co-location — it cannot confer the stable hostnames, ordered startup/shutdown, or per-instance persistent storage that a clustered database requires. The deployment controller replaces any failed Pod with a brand-new name and network identity, so cluster members cannot discover or reconnect to their peers.

  • StatefulSet with a headless Service

    Why this is correct

    A StatefulSet assigns each replica a stable ordinal name (e.g., pod-0, pod-1) and, when paired with a headless Service, gives each Pod a predictable DNS name like pod-0.mydb.svc.cluster.local. This creates the stable network identities and ordered provisioning/deprovisioning that stateful clustered applications need. Additionally, StatefulSets preserve persistent volume claims across restarts and scale up/down in a deterministic order, making them the standard choice for replicated databases and distributed systems.

  • DaemonSet with a unique hostname label on each node

    Why it's wrong here

    A DaemonSet ensures that one Pod runs on every node (or a subset selected by node labels), which is appropriate for node-level monitoring or networking agents. Although you could label each node with a unique hostname, the DaemonSet controller still generates Pod names based on the node, not with ordinal suffixes, and does not guarantee ordered startup or stable per-Pod identities. It also lacks the per-instance PersistentVolumeClaim management that a stateful database cluster requires, so peer discovery and failover would break whenever a DaemonSet Pod is rescheduled.

  • ReplicaSet with a fixed replica count

    Why it's wrong here

    A ReplicaSet simply maintains the specified number of identical, interchangeable Pods. While setting a fixed replica count ensures that a certain number of replicas exist, each Pod gets a random name and no guaranteed order, and any replacement gains a completely new identity and IP. There is no mechanism for stable DNS entries per instance or ordered lifecycle events, so clustered members could not reliably rejoin the cluster after a restart, making ReplicaSets unsuitable for stateful workloads like databases.

About these practice questions

Courseiva writes every ACE question from scratch — 769 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.