Skip to content

Services: Networking & Discovery

Pods are ephemeral: their IP addresses change every time they are restarted or rescheduled. A Service provides a stable virtual IP address and DNS name to route traffic reliably to matching Pods.


  • ClusterIP (Default): Exposes the Service on a cluster-internal IP. Reachable only within the cluster.
  • NodePort: Exposes the Service on each Node’s IP at a static port (in the range 30000–32767).
  • LoadBalancer: Provisions an external cloud load balancer (AWS NLB, GCP Load Balancer) pointing to NodePorts.
  • ExternalName: Maps the Service to the contents of the externalName field (e.g. api.stripe.com) returning a CNAME record.
  • Headless (clusterIP: None): Direct DNS resolution returning the individual IPs of all matching Pods (used by StatefulSets).

apiVersion: v1
kind: Service
metadata:
name: web-backend
spec:
type: ClusterIP
selector:
app: backend
ports:
- name: http
port: 80
targetPort: 8080