I am deploying the helm chart mongodb-replicaset. I have added the hostPort 27017 in the StatefulSet containers spec. However, the port is not being exposed. It is silently ignoring this. If I deploy a pod spec with hostPort in the same kube, it works. Is there something incompatible in the StatefulSet for this, or am I missing some configuration? My use case is I need the db to be externally accessible. Given how mongo works, load balancing makes no sense here, hostPort being the most direct path. Thanks for any information.
No, there are no additional settings for StatefulSet
required for NodePort
.
But, your NodePort
value should be in the available range (default: 30000-32767).
The simplest way to fix it is to set NodePort
value to one of the ports from the available range.