I am new to kubernetes and I went through many articles but didnt find a basic answer to my doubt.
Suppose I have 2 nodes kubernete cluster and I have deployed 2 applications on it then.
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?
It will have 1 pod per node? What will be the structure?
Node 1, Pod1 - > App1 Node 1, Pod1 - > App2 Node 2, Pod1 - > App1 Node 2, Pod1 - > App2
Node 1- Pod1 - > App1 Node 1- Pod2 - > App2 Node 2- Pod1 - > App1 Node 2- Pod2 - > App2
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.
In general, a Kubernetes app consists of a set of replicated pods (in most cases managed by a Deployment 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 must run on different nodes.
However, you can influence the decision of the scheduler with various mechanisms: