-
Notifications
You must be signed in to change notification settings - Fork 240
Description
Discussed in #9785
Originally posted by dudizimber September 30, 2025
We have a use case where we deploy multiple databases of the same type in a single k8s cluster.
The database requires external access via HostNetwork.
In our specific setup, the service port cannot be randomly generated and has to be specified when creating the Cluster, since not all databases will listen to the same port, even if they are of the same type.
While trying it out, I saw that the PortManager is the one that allocates a random port (not really random, but also not known before the allocation), and it does so by storing the allocated ports in a single configmap for the whole cluster, in the structure:
<pod>-<container>-<portName>: <portNumber>
Hence, in my interpretation, all databases in the k8s cluster of the same type (pod name) will receive the same port, as it always checks the name and returns the same port if it exists.
My question is if there's a way to accomplish that without modifying the operator.
Meaning that, when using HostNetwork, the port could be defined on the Cluster manifest.