ClusterIP, NodePort and LoadBalancer: when do you use each?
BeginnerScenarioKubernetes Networking
Answer
Situation read → These are the Service types that expose workloads at different scopes.
What I'd do →
- ClusterIP (default) is internal only, used for service-to-service traffic
- NodePort opens a port (30000-32767) on every node, mostly a building block or for dev
- LoadBalancer asks the cloud to create an external load balancer pointing at the service
- For HTTP apps use one Ingress or Gateway in front of several ClusterIP services
- Check with
kubectl get svc -o wide
Why → Each type builds on the previous: LoadBalancer includes a NodePort and a ClusterIP.
Interview tip → Say one LoadBalancer per service gets expensive, so you use Ingress.
More on Kubernetes Networking
Explain the Kubernetes networking model in one minute.BeginnerHow does a pod find another service by name?BeginnerService versus Ingress: what is the difference?BeginnerWhat does a CNI plugin do and which ones do you know?BeginnerHow do you reach a pod from your laptop for debugging without exposing it?BeginnerBy default, can any pod talk to any other pod, and how do you change that?Beginner