<p>I've investigated a couple of helm charts for apache spark deployment and found that most of them use statefulset for deployment instead of normal k8s deployment resource. </p>

<p>E.g. the <a href="https://hub.helm.sh/charts/microsoft/spark" rel="nofollow noreferrer">microsoft/spark</a> uses normal deployment while <a href="https://hub.helm.sh/charts/bitnami/spark" rel="nofollow noreferrer">bitnami/spark</a> prefers statefulset.</p>

<p>I am just wondering is there any specific reason to do that? </p>

Russell Bie
<p>Apache Spark is a <em>stateful</em> service, those should be deployed as <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSet</a>.</p>

<p>Only <em>stateless</em> services should be deployed as <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Deployment</a>. Applications that are <em>stateless</em> follow the <a href="https://12factor.net/" rel="nofollow noreferrer">Twelve Factor App</a> principles. Making an app stateless make it much easier to run as a distributed system e.g. multiple instances in Kubernetes. But not everything can be stateless, and StatefulSet is a an option for <em>stateful</em> services.</p>
