Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsHard
A developer needs to configure a Pod that requires stable, unique network identifiers (hostnames) and persistent storage that follows the Pod's lifecycle, even through rescheduling. Which Kubernetes workload object is designed for this specific requirement?
- AStatefulSet
- BDeployment
- CReplicaSet
- DDaemonSet
Show answer & explanationAnswer & explanation
Correct answer: A. StatefulSet
StatefulSets are specifically designed for stateful applications, providing stable, unique network identifiers, stable persistent storage (via PersistentVolumeClaims), and ordered, graceful deployment and scaling. Deployments and ReplicaSets are for stateless applications, and DaemonSets are for node-local services.
Why the other options are wrong
- B. Deployments manage stateless applications and don't provide stable network IDs or persistent storage tied to individual Pods.
- C. ReplicaSets are a lower-level controller for stateless Pods, managed by Deployments.
- D. DaemonSets ensure a Pod runs on each node and are not designed for stable network IDs or Pod-specific persistent storage.
Kubernetes StatefulSet
A StatefulSet is a Kubernetes API object used to manage stateful applications. It provides stable, unique network identifiers, stable persistent storage, and ordered, graceful deployment and scaling.
- Manages stateful applications (e.g., databases).
- Provides stable network identity (hostname).
- Ensures stable, persistent storage for each replica.
- Ordered scaling and updates.
Memory trick: A 'StatefulSet' provides 'Stable' 'Storage' and 'Stable' 'Identities'.