<p>Consider we have two different Docker images both exposing the same port (80, for example).</p>

<p>Now we'd like to create a multi-container Pod in Kubernetes cluster that contains containers created from these images.</p>

<p>Is there a way to setup such configuration without changing images? How to map ports on Pod level?</p>

<p>Containers inside a Kubernetes Pod share different linux namespaces for things like networking, pid or file system. <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#networking" rel="nofollow noreferrer">From the docs</a></p>

<blockquote>
  <p>Each Pod is assigned a unique IP address. Every container in a Pod shares the network namespace, including the IP address and network ports. Containers inside a Pod can communicate with one another using localhost</p>
</blockquote>

<p>So the same way you can't have two processes listening on the same port on your machine, you can't have two containers that share the networking namespace listen on the same port.</p>
