<p>Is is possible to have two web services in a single pod in kubernetes. If yes how will load balancer will handle it? One more question, does load balancer talk directly to pod or container inside pod? If its talk to pod doesn't the route increase like first, LB->pod, pod->container. As pod is in between.  I am new to Kubernetes and had these doubts.</p>

Sid
<p>You <em>can</em> run multiple containers inside a single pod, but using that to host two separate services is probably not the intended use.</p>

<p>An example case for running multiple containers inside the same pod is one container, a so-called sidecar, that's running some form of application to generate files (e.g. some sync tool), while the main service uses those files somehow. This could be a web server serving static files that the sync tool pulls from somewhere.</p>

<p>Back to your question, since a pod only has one IP, you can only use each port once. A port on a container corresponds directly to a port on the pod. So while you can <em>theoretically</em> run two containers with a web service, you will need to use two different ports. As such, the load balancer would need to address those two ports separately.</p>

<p>If you want to run multiple copies of the same service for load balancing, you should use multiple pods, ideally managed by a deployment, and use a service (cluster IP for internal or <a href="https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer" rel="nofollow noreferrer">load balancer</a> for external) to distribute traffic.</p>
