Kubernetes (K8s) (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
Deployments vs. ReplicaSets vs. StatefulSets: When to use each?
junior LevelKubernetes
In Simple Words:
- ReplicaSet: Low-level controller that ensures a specified number of identical Pod replicas are running at any given time.
- Deployment: Higher-level controller that manages ReplicaSets. Handles declarative zero-downtime rolling updates, pause/resume, and rollbacks. The default choice for stateless web applications and APIs.
- StatefulSet: Manages stateful workloads (databases like PostgreSQL, Redis clusters, Kafka brokers):
- Provides stable, unique network identifiers (
kafka-0,kafka-1,kafka-2). - Provides stable, dedicated persistent storage bound to ordinal IDs via
volumeClaimTemplates. - Ordered, sequential deployment, scaling, and rolling updates (0, then 1, then 2).
- Provides stable, unique network identifiers (