<p>I would like to run a single pod of Mongo db in my Kubernetes cluster. I would be using node selector to get the pod scheduled on a specific node.</p>
<p>Since Mongo is a database and I am using node selector, is there any reason for me not to use Kubernetes Deployment over StatefulSet? Elaborate more on this if we should never use Deployment.</p>

RamPrakash
<blockquote>
<p>Since mongo is a database and I am using node selector, Is there any reason for me not to use k8s deployment over StatefulSet? Elaborate more on this if we should never use Deployment.</p>
</blockquote>
<p>You should not run a database (or other stateful workload) as <code>Deployment</code>, use <code>StatefulSet</code> for those.</p>
<p>They have different semantics while updating or when the pod becomes unreachable. <code>StatefulSet</code> use <strong>at-most-X</strong> semantics and <code>Deployments</code> use <strong>at-least-X</strong> semantics, where X is number of replicas.</p>
<p>E.g. if the node becomes unreachable (e.g. network issue), for Deployment, a new Pod will be created on a different node (to follow your desired 1 replica), but for StatefulSet it will make sure to terminate the existing Pod before creating a new, so that there are never more than 1 (when you have 1 as desired number of replicas).</p>
<p>If you run a database, I assume that you want the data consistent, so you don't want duplicate instances with different data - (but should probably run a distributed database instead).</p>
