PortManager and HostNetwork #9785
Replies: 4 comments 7 replies
-
|
@shanshanying could I get your input here please? |
Beta Was this translation helpful? Give feedback.
-
|
Adding to the initial post, I understand that the HostPort can be defined on the ComponentDefinition manifest and will be reused for all Clusters using that CD. |
Beta Was this translation helpful? Give feedback.
-
|
we declare in ComponentDefinition (CMPD) the set of PORTs should be replaced when HostNetwork is used. And when creating cluster with HostNetwork Enabled (through annoatation 'kubeblocks.io/host-network'), KB will allocated ports for them. and those PODs from the same Component will be allocated with the same set of PORTs. but Pods from different clusters have differnt ports. |
Beta Was this translation helpful? Give feedback.
-
|
Moved to issue #9818 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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:
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.
Beta Was this translation helpful? Give feedback.
All reactions