Interview Prep/Networking/Kubernetes Networking

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 →

  1. ClusterIP (default) is internal only, used for service-to-service traffic
  2. NodePort opens a port (30000-32767) on every node, mostly a building block or for dev
  3. LoadBalancer asks the cloud to create an external load balancer pointing at the service
  4. For HTTP apps use one Ingress or Gateway in front of several ClusterIP services
  5. 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.

All Networking questions Roadmap: Networking for DevOps

More on Kubernetes Networking