What is a NodePort and when would you use one?
BeginnerConceptKubernetes, Containers, MTU & Performance Basics
Answer
A NodePort Service opens the same port (30000–32767 by default) on every node and forwards it to the Service's pods. It is the building block under LoadBalancer Services and handy for quick tests or when an external load balancer targets nodes directly.
kubectl expose deploy web --type=NodePort --port=80
curl http://<node-ip>:<nodePort>
Do not expose NodePorts to the internet directly; put a load balancer in front and restrict the security group.
More on Kubernetes, Containers, MTU & Performance Basics
What are the basic Kubernetes networking rules?BeginnerWhat are the Service types in Kubernetes?BeginnerWhat is the difference between a Service and an Ingress?BeginnerHow does kube-proxy implement Services?AdvancedHow does DNS work for Services and pods in Kubernetes?IntermediateWhat is a CNI plugin and how do the main ones differ?Intermediate