<p>I know why use StatefulSet for stateful applications. (e.g. DB or something)
In most cases, I can see like &quot;You want to deploy stateful app to k8s? Use StatefulSet!&quot;
However, I couldn't see like &quot;You want to deploy stateless app to k8s? Then, DO NOT USE StatefulSet&quot; ever.</p>
<p>Even nobody says &quot;I don't recommend to use StatefulSet for stateless app&quot;, many stateless apps is deployed through Deployment, like it is the standard.</p>
<p>The StatefulSet has clear pros for stateful app, but I think Deployment doesn't for stateless app.
Is there any pros in Deployment for stateless apps? Or is there any clear cons in StatefulSet for stateless apps?</p>
<p>I supposed that StatefulSet cannot use LoadBalancer Service or StatefulSet has penalty to use HPA, but all these are wrong.</p>
<p>I'm really curious about this question.</p>
<p>P.S. Precondition is the stateless app also uses the PV, but not persists stateful data, for example logs.</p>
<p>I googled &quot;When not to use StatefulSet&quot;, &quot;when Deployment is better than StatefulSet&quot;, &quot;Why Deployment is used for stateless apps&quot;, or something more questions.</p>
<p>I also see the k8s docs about StatefulSet either.</p>

<p>In contrast to a Kubernetes Deployment, where pods are easily replaceable, each pod in a StatefulSet is given a name and treated individually. Pods with distinct identities are necessary for stateful applications.</p>
<p>This implies that if any pod perishes, it will be apparent right away. StatefulSets act as controllers but do not generate ReplicaSets; rather, they generate pods with distinctive names that follow a predefined pattern. The ordinal index appears in the DNS name of a pod. A distinct persistent volume claim (PVC) is created for each pod, and each replica in a StatefulSet has its own state.</p>
<p>For instance, a StatefulSet with four replicas generates four pods, each of which has its own volume, or four PVCs. StatefulSets require a headless service to return the IPs of the associated pods and enable direct interaction with them. The headless service has a service IP but no IP address and has to be created separately.The major components of a StatefulSet are the set itself, the persistent volume and the headless service.</p>
<p>That all being said, people deploy Stateful Applications with Deployments, usually they mount a RWX PV into the pods so all &quot;frontends&quot; share the same backend. Quite common in CNCF projects.</p>
