<p>Is it possible to dynamically assign port numbers in kubernetes?</p>

<p>Use Case: I have logstash, Kafka, Cassandra and other services running in kubernetes and I create multiple pipelines in different namespaces. </p>

<p>Everytime I create a pipeline, I need to change the container ports for each pod so that there won't be any port conflict.</p>

<p>I am looking for something where in kubernetes can give me a unused port number from the pool or an option to create a named port like kafka_port or logstash_port so that I do not have to worry about changing the container ports for each pipeline.</p>

<p>Please advise.</p>

bigskull
<p>For pods, you dont need to randomize ports as each of them has its own networking namespace. Unless you use hostNetwork.</p>

<p>For services, NodePort type of service will be  assigned random high ports regardless of the port numbers your pods listen on</p>
