<p>I've been doing a lot of digging on Kubernetes, and I'm liking what I see a lot! One thing I've been unable to get a clear idea about is what the exact distinctions are between the Deployment and StatefulSet resources and in which scenarios would you use each (or is one generally preferred over the other).</p>

<p>Deployments and ReplicationControllers are meant for stateless usage and are rather lightweight. <a href="https://kubernetes.io/blog/2016/12/statefulset-run-scale-stateful-applications-in-kubernetes/" rel="noreferrer">StatefulSets</a> are used when state has to be persisted. Therefore the latter use <code>volumeClaimTemplates</code> / claims on persistent volumes to ensure they can keep the state across component restarts.</p>

<p>So if your application is stateful or if you want to deploy stateful storage on top of Kubernetes use a StatefulSet.</p>

<p>If your application is stateless or if state can be built up from backend-systems during the start then use Deployments.</p>

<p>Further details about running stateful application can be found in <a href="https://kubernetes.io/blog/2016/12/statefulset-run-scale-stateful-applications-in-kubernetes/" rel="noreferrer">2016 kubernetes' blog entry about stateful applications</a></p>
