Interview Prep/Kubernetes/Services, Ingress and DNS

When do you use ClusterIP, NodePort, LoadBalancer and ExternalName?

BeginnerScenarioServices, Ingress and DNS
Answer

Situation read → A developer asks how to expose a new internal API and a public website.

What I'd do →

  1. ClusterIP for in-cluster traffic, the default
  2. NodePort mostly for debugging or when a load balancer sits in front
  3. LoadBalancer to get a cloud LB per Service, such as an NLB on EKS
  4. Ingress or Gateway API in front of many HTTP services to share one LB
  5. ExternalName to alias an external DNS name through a cluster DNS CNAME

Why → Each type builds on the previous: LoadBalancer includes NodePort, which includes ClusterIP.

Interview tip → Say that you rarely give every service its own LB in production because of cost.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS