Kubernetes: Deployment vs StatefulSet vs DaemonSet?

posée 4 months ago624 vuesen

1

When do I use each of these workload types? I'm deploying a web API, a PostgreSQL database and a log collector.

Diagnostic IA

Généré par IA. Ce n'est pas une réponse — la communauté ci-dessous le confirme ou le corrige. Vérifiez toujours avant de vous y fier.

posée 4 months ago

1 réponse

6
✓
✓ Réponse acceptée

- 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.

Connectez-vous pour dire si ça a marché.

answered 4 months ago

Sign in and verify your email to post an answer.