<p dir="auto">Not sure how this could be done but for our application we could run the same container 10 times on the same minion quite happily using different ports as it is lightweight. To load balance though we would need to map the ports back to appear as one service port. To allow other machines to talk to it easily.</p>
<p dir="auto">May be it could hang of the container port name and a matching regex on the pod name. So all pods that start Fred- with a port called http would be load balanced by the same service?</p>
<p dir="auto">IIUC, host port numbers in each pods are not important for replicated services in Kubernetes.<br>
From the perspective of orchestration, the important thing is port of service, but not port of pod.</p>
<p dir="auto">Also manual assignment of host port can be troublesome because spawn of container just fails if the container manifest specified a port which is already taken by other containers or Kubernetes daemons.</p>
<p dir="auto">So I propose the following enhancement.</p>
<ul dir="auto">
<li>Keep tracking taken ports in etcd</li>
<li>Allow omitting host port in container manifest
<ul dir="auto">
<li>If omitted, Kubelet automatically choose an available host port for each exposed container port.</li>
</ul>
</li>
</ul>