Skip to main content

Module node_port

Module node_port 

Source
Expand description

NODEPORT ALLOCATION.

★ WHY IT WAS MISSING AND WHY THAT SHOWS. Service.spec.type: NodePort was accepted, stored, and then did nothing: no port was assigned, so kubectl get svc showed an empty nodePort column and nothing outside the cluster could reach the service. The Service reported no error — the field simply stayed absent — which is the worst shape a gap can take, because the operator’s YAML was correct and the cluster agreed with it right up until they tried to connect.

★ THE RANGE IS A CONTRACT WITH THE NODE, NOT A PREFERENCE. 30000–32767 is upstream’s default --service-node-port-range, and it is chosen to sit above the ephemeral-port floor so an allocated NodePort cannot collide with an outbound connection’s source port. Allocating outside it produces a service that works until the kernel happens to pick the same port for something else — an intermittent failure with no discoverable cause.

★ AN EXPLICIT REQUEST IS HONOURED OR REFUSED, NEVER SILENTLY MOVED. A user who wrote nodePort: 30080 has almost certainly written it into a firewall rule or a load-balancer config too. Quietly assigning 30081 instead would produce a service that is up, reachable on a port nobody configured, and unreachable on the one everybody did.

★ THE ALLOCATOR IS RESEEDED FROM LIVE SERVICES, never persisted separately. The Services ARE the ledger — the same decision cluster_ip makes, and for the same reason: a second copy of the allocation state is a second thing that can be wrong, and on restart the wrong one wins silently.

Structs§

NodePortAllocator
Collision-free NodePort allocation over a fixed range.

Enums§

NodePortError
Allocation failures.

Constants§

DEFAULT_RANGE
Upstream’s default --service-node-port-range.

Functions§

wants_node_ports
Does this Service type get NodePorts?