Kubernetes: Deployment vs StatefulSet vs DaemonSet?
poze 4 months ago618 gadeen
When do I use each of these workload types? I'm deploying a web API, a PostgreSQL database and a log collector.
Dyagnostik IA
Se IA ki fè l. Se pa yon repons — kominote a anba a konfime oswa korije l. Toujou verifye anvan ou fye l.
1 Repons
- Deployment: for stateless apps. Pods are interchangeable and can be killed, rescheduled and scaled freely. → your web API. - StatefulSet: for apps needing stable identity and storage. Each pod gets a stable name (db-0, db-1) and its own PersistentVolume, and pods start and stop in order. → databases, Kafka, Elasticsearch. - DaemonSet: runs exactly one pod per node. → log collectors (Fluent Bit), monitoring agents, CNI plugins.
Practical advice on the database: unless you have strong Kubernetes operations experience, use a managed database (RDS, Cloud SQL, Azure Database, Supabase, Neon), or an operator like CloudNativePG if it must run in-cluster. Running Postgres on a raw StatefulSet means handling backups, failover and upgrades yourself.
Konekte pou di lòt moun si li te mache.
Sign in and verify your email to post an answer.