简体   繁体   中英

kuberetes hostPort declaration not working for pods in StatefulSet, any extra config needed?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM