Pcornel
Containers · Kubernetes Networking & Services

Service Types

Cheat sheet · https://pcornel.dk/topic.php?topic=6148

Back to the Topic

Answer

Service types: ClusterIP (internal), NodePort (port on every node), LoadBalancer (cloud/MetalLB load balancer), ExternalName (DNS alias); headless Services return pod IPs.

Remember

Endpoints must exist; targetPort must match the container port. LoadBalancer Pending → no load balancer provider.

First checks

  • kubectl get svc <s> -o wide — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl logs <pod> [-c <c>] [--previous] — container logs (incl. previous crash)
  • kubectl get events --sort-by=.lastTimestamp — recent cluster events

Commands

kubectl get endpointslices -l kubernetes.io/service-name=web

Verify in this order

client → Service (ClusterIP/NodePort/LB) → endpoints

Where it usually breaks

A selector that does not match Pod labels gives a Service with no endpoints.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6148

Confirmation

Confirm action

Continue?