Can the Kubernetes NodePort service port change upon service restart or pod crash? How do you ensure that the port of NodePort service remains the same?
From documentation
If you set the type field to NodePort, the Kubernetes master will allocate a port from a range specified by --service-node-port-range flag (default: 30000-32767), and each Node will proxy that port (the same port number on every Node) into your Service. That port will be reported in your Service’s .spec.ports[*].nodePort field.
Pod crash or restart will not change your NodePort. Re-creating your service will.
You can specify a custom NodePort as described in this answer, this will keep Service's NodePort the same