Interview Prep/Networking/Kubernetes, Containers, MTU & Performance Basics

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.

All Networking questions Roadmap: Networking for DevOps

More on Kubernetes, Containers, MTU & Performance Basics