<p>For the first part of the question, I want to know how k8s may deploy a new pod dynamically and make it functional.</p>

<p>For the second part, let's suppose that we have two pods (A and B) that communicate together, so if we deploy a new pod (let C) How can Kubernetes change the datapath by forcing A and B to communicate via C?</p>

<p>I'll be so thankful for any suggestion.    </p>

Smaillns
<blockquote>
  <p>I want to know how k8s may deploy a new pod dynamically and make it functional.</p>
</blockquote>

<p>Generally, through a workload controller like a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Deployment</a>, <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/" rel="nofollow noreferrer">DaemonSet</a>, <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSet</a>, etc.</p>

<blockquote>
  <p>let's suppose that we have two pods (A and B) that communicate together, so if we deploy a new pod (let C) How can Kubernetes change the datapath by forcing A and B to communicate via C?</p>
</blockquote>

<p>Generally, it's done through service discovery with <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">DNS</a>. There are other alternatives like using something like <a href="https://www.consul.io/" rel="nofollow noreferrer">Consul</a> which can also use DNS and/or it has its own <a href="https://www.consul.io/docs/agent/services.html" rel="nofollow noreferrer">catalog</a></p>
