I am working with a minecraft server image to create a cluster of statefulsets that all should have a random external port. I was told using a nodeport would do the job but not exactly how that is done. I was looking at nodeport but it looks like you would need to specify that exact port name.
I need each replica in a cluster to either have a random external IP or a random external port on the same IP, Is that possible or do I need to create a service for every single port/IP.
You need to create a
NodePort
service for each instance of minecraft server.A
NodePort
open a random port up to < 30000 and links it to an internal (set of) based on the selectors.For instance, let's say there is one instance of the minecraft server with the following resource:
This is the
nodePort
description to reach it on port 30007 (on every node of the cluster):