Kubernetes Services, LoadBalancing & Ingress: Full Summary

Vishnu MohanVishnu Mohan
4 min read

🧩 Core Types of Kubernetes Services

Service TypePurposeExposed ToNotes
ClusterIPInternal-only service (default)Within the clusterMost common; used for pod-to-pod or service-to-service comms
NodePortExposes service on static port on each nodeExternal (via <NodeIP>:<Port>)Limited range (30000–32767), basic, not scalable
LoadBalancerProvisions external cloud LB automaticallyExternal (cloud-managed)Routes traffic via NodePorts under the hood
ExternalNameMaps service to an external DNS nameInternal clientsRarely used; DNS alias only; no IP or port involved

πŸ“¦ Pod + Service Relationships

  • A Pod can be backed by multiple Services (e.g., one for internal access, another for external).

  • Services use label selectors to target Pods.

  • Pods are ephemeral β€” Services offer a stable IP (ClusterIP) + DNS to reliably route to them.

  • Even NodePort and LoadBalancer services have a ClusterIP internally β€” used within the cluster.


🌐 NodePort Limitations (and when to use)

  • Each NodePort must be unique across the cluster.

  • You can’t expose two different services on the same NodePort (e.g., both on 30080).

  • You can have many apps listening on container port 80/443 β€” the problem is only at the NodePort level.

  • NodePort doesn't support:

    • TLS termination

    • Path/host-based routing

    • DNS (you manage that)

  • NodePort is manual, basic, and not suitable for scale.


☁️ LoadBalancer Services: Simpler External Exposure (Cloud-Only)

  • type: LoadBalancer creates a real cloud load balancer (e.g., AWS ELB/NLB).

  • Kubernetes leverages the Cloud Controller Manager (CCM) to:

    • Create the external LB

    • Assign it a public IP/DNS

    • Hook it into NodePorts

  • Uses NodePort under the hood β†’ LoadBalancer routes traffic to all healthy nodes.

✨ Your Breakthrough:

β€œEven though LoadBalancer is a K8s resource, it reaches outside and provisions real infra like AWS ELB β€” via the CCM!”


πŸ“¦ Cloud Controller Manager (CCM) vs Ingress Controller

FeatureCloud Controller Manager (CCM)Ingress Controller (e.g., NGINX)
LivesControl PlaneRuns inside the cluster
PurposeTalks to Cloud APIsRoutes HTTP/S traffic to services
Handles LoadBalancersβœ… Yes❌ No
Handles Ingress resources❌ Noβœ… Yes

🧠 Ingress: Smart, Scalable HTTP Gateway

πŸ”₯ Your Key Insight:

β€œSo LoadBalancer exposes a single service, but Ingress can expose many services behind a single LB using DNS/path rules β€” that's powerful!”

🧱 Components:

  • Ingress Resource: Defines rules (host/path) for routing traffic.

  • Ingress Controller: The actual software (e.g., NGINX, Traefik) that applies those rules.

  • Ingress exposes services via Layer 7 (HTTP/HTTPS) β€” with support for:

    • TLS termination

    • Custom domains (host-based routing)

    • Path-based routing

    • Middleware (rate limiting, auth, etc.)


πŸ’‘ Why Ingress > LoadBalancer at Scale

FeatureService: LoadBalancerIngress
Layer4 (TCP/UDP)7 (HTTP/S)
TLS Termination❌ Manualβœ… Built-in with cert-manager
Host/Path Routing❌ Noβœ… Yes
Cost in CloudπŸ’Έ Per serviceπŸ’° Single LB for all apps
Ease of DNS Management❌ Manualβœ… Just one DNS + rules

Real-World Analogy:

Using LoadBalancer for every app is like giving each microservice its own road to the city. Using Ingress is like building a highway with smart exits.


πŸ› οΈ What About Self-Hosted Clusters (e.g., kubeadm)?

βœ… Breakthrough:

β€œSo type: LoadBalancer does nothing useful unless you have a cloud provider? Got it.”

πŸ’‘ Your Options:

OptionDescriptionBest For
NodePort + external NGINXRun LB yourself, manually forward trafficTotal control, DIY setups
MetalLBBring LoadBalancer support to bare metalHome labs, private DCs
Ingress + NodePort/MetalLBUse smart HTTP proxy with internal servicesScalable, TLS-enabled

πŸ”„ Flow Summary: How Traffic Reaches Pods

Using LoadBalancer:

plaintextCopyEditClient β†’ Cloud LoadBalancer (AWS ELB) β†’ NodePort on Nodes β†’ ClusterIP β†’ Pod

Using Ingress:

plaintextCopyEditClient β†’ Cloud LoadBalancer β†’ Ingress Controller (NGINX) β†’ ClusterIP β†’ Pod

Using NodePort (direct):

plaintextCopyEditClient β†’ NodeIP:NodePort β†’ ClusterIP β†’ Pod

πŸ”‘ Final Takeaways β€” Your Breakthroughs

  1. Ingress β‰  Ingress Controller β€” Ingress is just a config; the Controller does the real work.

  2. LoadBalancer β‰  Smart Router β€” It’s a raw L4 passthrough. For TLS, DNS, routing, use Ingress.

  3. Pods are ephemeral, Services are stable β€” Service discovery is all about ClusterIP and DNS stability.

  4. NodePort is minimalistic, suitable for dev/test or when using external NGINX/HAProxy.

  5. LoadBalancer is ideal in cloud, but Ingress is the smarter, scalable, multi-service entrypoint.

  6. CCM provisions infra, while Ingress Controller routes app traffic.

0
Subscribe to my newsletter

Read articles from Vishnu Mohan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vishnu Mohan
Vishnu Mohan

Software Engineer | Cloud Security