<p>I would like to know how exactly pods get an IP address, and how they distribute the pods to agent and master.</p>
<p>I have 1 master node and 2 agent nodes. my pods all are running well, but I am curious how the pods get an IP address.</p>
<p>some pods have IP cluster nodes, meanwhile, some have an ethernet IP address. I run Nginx and Metallb for the load balancer. Disable Traefik and Klipper.</p>
<p>if we can see the agent-03 has 2 IP addresses run on</p>
<pre><code>root:/# kubectl get pods -A -o wide

ingress          nginx-dep-fdcd8sdfs-gj5gff                 1/1     Running   0          46h     10.42.0.80      master          &lt;none&gt;           &lt;none&gt;

ingress          nginx-dep-fdcd8sdfs-dn80n                1/1     Running   0          46h     10.42.0.79      master          &lt;none&gt;           &lt;none&gt;

ingress          nginx-doc-7cc85c5899-sdh55              1/1     Running   0          44h     10.42.0.82      master          &lt;none&gt;           &lt;none&gt;

ingress          nginx-doc-7cc85c5899-gjghs               1/1     Running   0          44h     10.42.0.83      master          &lt;none&gt;           &lt;none&gt;

prometheus       prometheus-node-exporter-6tl8t    1/1     Running   0          47h     192.168.1.3   agent-03    &lt;none&gt;           &lt;none&gt;

ingress          ingress-controller-nginx-ingress-controller-rqs8n            1/1     Running   5          47h     192.168.1.3    agent-03   &lt;none&gt;           &lt;none&gt;

prometheus       prometheus-kube-prometheus-operator-68fbcb6d67-8qsnf       1/1     Running   1          46h     10.42.2.52     agent-03    &lt;none&gt;           &lt;none&gt;

ingress          nginx-doc-7cc85c5899-b77j6                1/1     Running   0          43h     10.42.2.57      agent-03    &lt;none&gt;           &lt;none&gt;

metallb-system   speaker-sk4pz                                 1/1     Running   1          47h     192.168.1.3    agent-03   &lt;none&gt;           &lt;none&gt;

</code></pre>
<p>in my pod's shows agent-03 run Nginx-doc use IP cluster while metal use IP ethernet, or it depends on what service are running in pods?</p>
<pre><code>ingress          nginx-doc-7cc85c5899-b77j6                  1/1     Running   0          43h     10.42.2.57      agent-03    &lt;none&gt;           &lt;none&gt;

metallb-system   speaker-sk4pz                                   1/1     Running   1          47h     192.168.1.3    agent-03   &lt;none&gt;           &lt;none&gt;
</code></pre>
<p>and I can see master has 2  Nginx-doc pods running, which means when I deploy 3 Nginx-doc one agent will not get any Nginx-doc because it has been taken by the master. and it is not divided equally.</p>
<p>If I miss configuring which part do I need to fix.</p>

newcomers
<p>Based on your internal plugin your POD will get the IPs. Which again will be the internal IPs mostly.</p>
<p>There are different types of Network interfaces, we can use <strong>CNI</strong> as per need : <a href="https://kubernetes.io/docs/concepts/cluster-administration/networking/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/cluster-administration/networking/</a></p>
<p>POD gets exposed by the <strong>service</strong>. There are different types of services. <strong>Cluster IP</strong>, <strong>Node Port</strong>, <strong>Load Balancer.</strong> <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>
<blockquote>
<p>in my pod's shows agent-03 run Nginx-doc use IP cluster while metal
use IP ethernet, or it depends on what service are running in pods?</p>
</blockquote>
<p>Could be possible due to the service type you are using due to that IP is different and using ethernet.</p>
<p>If your service type is <strong>LoadBalancer</strong> using <strong>MetalLb</strong> which means that the service is exposed using the <strong>IP</strong>, not like internal IP that PODs have mostly.</p>
<p><code>kubectl get svc -n &lt;namespace name&gt;</code> and check</p>
<blockquote>
<p>and I can see master has 2 Nginx-doc pods running, which means when I
deploy 3 Nginx-doc one agent will not get any Nginx-doc because it has
been taken by the master. and it is not divided equally.</p>
</blockquote>
<p>There is no guarantee on that, K8s put and assign pods based on score.</p>
<p>You can read more about score at here : <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/</a></p>
<p>If you want to fix your POD on a specific node, suppose you are running the GPU with Node your should schedule on that Node to use GPU in that case you can use.</p>
<p><a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/</a></p>
