Kubernetes Services & Ingress Routing
Pods are mortal. They die, scale up, scale down, and get rescheduled onto different nodes, changing their IP addresses continuously. A Kubernetes Service provides a stable, permanent IP and DNS entry that…
Lesson 10 of 26 · Module: Kubernetes
20 min read · Source notes — Services & Gateway API
Pods are mortal. They die, scale up, scale down, and get rescheduled onto different nodes, changing their IP addresses continuously. A Kubernetes Service provides a stable, permanent IP and DNS entry that automatically load-balances traffic across healthy matching Pods.

Instructor explaining label selectors and EndpointSlices routing to pod targets.
The 3 Primary Service Types
| Type | Accessibility | DevOps Use Case |
|---|---|---|
| ClusterIP (Default) | Internal only (within cluster) | Standard for databases, internal APIs, Redis caches that should never be reached from the public internet. |
| NodePort | External via Node IP + high port (30000–32767) | Exposing services on bare-metal clusters or on-premise environments without a cloud load balancer. |
| LoadBalancer | External public IP provisioned by Cloud Provider | Provisions an AWS NLB/ALB or GCP Cloud Load Balancer automatically to route internet traffic into the cluster. |
ClusterIP Service YAML Definition
apiVersion: v1
kind: Service
metadata:
name: api-service
namespace: production
spec:
type: ClusterIP
selector:
# Traffic is forwarded to any pod having this exact label!
app: api-service
ports:
- protocol: TCP
port: 80 # Port the service listens on inside the cluster
targetPort: 8080 # Port the application container is listening on
The modern Kubernetes Gateway API replacing legacy ingress objects with role-oriented routing.
Ingress: HTTP/HTTPS Host & Path Routing
A single cloud LoadBalancer costs $15–$25/month. If you have 20 microservices, creating 20 LoadBalancer services costs $500/month! Ingress solves this by using a single public LoadBalancer running an Ingress Controller (like NGINX or Traefik) that inspects HTTP headers to route traffic:
Production Ingress Routing Definition
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: main-ingress
namespace: production
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
tls:
- hosts:
- api.company.com
secretName: api-company-tls
rules:
- host: api.company.com
http:
paths:
- path: /v1/users
pathType: Prefix
backend:
service:
name: users-service
port:
number: 80
- path: /v1/orders
pathType: Prefix
backend:
service:
name: orders-service
port:
number: 80Keep going: ← Lesson 9 · Lesson 11 → · Module overview · Track it in the Self Guide
Finished this one?
Part of Self Guide · Stage 4: Kubernetes. Progress is saved in this browser.



