<p>I am new to kubernetes and I went through many articles but didnt find a basic answer to my doubt.</p>

<p>Suppose I have 2 nodes kubernete cluster and I have deployed 2 applications on it then.</p>

<ol>
<li><p>My both of the apps will be hosted on both of the nodes? Like app1 on both of the nodes and similarly app2? it means we have replication factor of 2 by default. Correct?</p></li>
<li><p>It will have 1 pod per node? What will be the structure?</p></li>
</ol>

<blockquote>
<pre><code>Node 1, Pod1 - &gt; App1
Node 1, Pod1 - &gt; App2
Node 2, Pod1 - &gt; App1
Node 2, Pod1 - &gt; App2
</code></pre>
</blockquote>

<ol start="3">
<li>If I have set replication factor=2 then how it will affect the structure? Will it create </li>
</ol>

<blockquote>
<pre><code>Node 1- Pod1 - &gt; App1
Node 1- Pod2 - &gt; App2
Node 2- Pod1 - &gt; App1
Node 2- Pod2 - &gt; App2
</code></pre>
</blockquote>

<ol start="4">
<li>What is deployment in terms of above physical/logical structures? How it differs with service? Deployment is specific to per node?</li>
</ol>

Roobal Jindal
<p>There's no predefined tying of pods to nodes. The Kubernetes scheduler dynamically decides which node to assign a pod to when the pod is created.</p>

<p>In general, a Kubernetes app consists of a set of replicated pods (in most cases managed by a <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#deployment-v1-apps" rel="nofollow noreferrer">Deployment</a> resource). Which nodes these pods end up running on is up to the scheduler. There's no built-in policy that replica pods of the same app <em>must</em> run on different nodes.</p>

<p>However, you can influence the decision of the scheduler with various mechanisms:</p>

<ul>
<li><a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity" rel="nofollow noreferrer">Node affinity</a></li>
<li><a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity" rel="nofollow noreferrer">Pod affinity and anti-affinity</a></li>
<li><a href="https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/" rel="nofollow noreferrer">Node taints and tolerations</a></li>
</ul>
