<p>I understand the logic behind replicating a pod across nodes, but is there any benefit to replicating pods in the same node? From my understanding this doesn't increase degree of replication, because one pod can take down a node.</p>

Daniel Kobe
<p><em>Replication of pods within a node?</em></p>

<p>You can handle the replication condition/count using some metrics but you can't handle the spawning of the pods on the same node until unless there is some affinity set, as it's handled by kube-scheduler. However you can set various <strong>pod/node affinities</strong>, <strong>anti affinities</strong> and <strong>topologykey</strong> [if you wish to maintain a minimum number of pods on a particular node]. </p>

<p><em>One pod can take a node down?</em> </p>

<p>I highly doubt that, it can only happen if you don't have any <strong>requests/limits</strong> set for <strong>CPU/Memory</strong> or if in your <strong>HPA</strong> the maximum replicas are set to increase more than the capacity of the node with a condition that podaffinity is set so all the pods will be spawning on the same node.</p>

<p><em>When can such a scenario make sense?</em></p>

<p>The reason for it can be if your nodes are of irregular size. And you want to consume a particular node more than other nodes in the cluster.</p>

<p>In a best practices environment all the nodes are of regular size. HPA is set and limits/quotas are provided so that a pod doesn't crash a node by crossing all the limits of a node.</p>

<p><strong>EDIT</strong> from comments:</p>

<blockquote>
  <p>So what if I want to run multiple instances of a nodejs app to utilize all the cores on my kube node? Lets say 8 cores, does it make sense to replicate the nodejs app pod 8 times in the same kube node or is it better to have 1 pod spin up 8 instances of the nodejs app?</p>
</blockquote>

<ul>
<li>A single-threaded application in your case, a pod will be considered as an instance. A pod to spin up 8 instances? It will be a multi-container pod with 8 containers of the same image, that would really be a bad practice and surely not even worth a test environment. However, having different replicas for the same Deployment is a do-able practice. But the question is how will you stop the Kubernetes service that if a pod is already serving some request and is in the lock state how will the request be routed to another pod. That's only possible by HPA if max request per pod is set to 1.</li>
</ul>

<blockquote>
  <p>Why not use NodeJS Cluster module for kubernetes to utilise all the cores of the node in the cluster where App is deployed? -- Suggestion by @DanielKobe</p>
</blockquote>

<ul>
<li><a href="https://stackoverflow.com/questions/48140983/node-js-scaling-out-on-kubernetes">node-js-scaling-out-on-kubernetes</a> </li>
<li><a href="https://stackoverflow.com/questions/52501858/should-you-use-pm2-node-cluster-or-neither-in-kubernetes">Should-you-use-pm2-node-cluster-or-neither-in-kubernetes</a></li>
</ul>
