Kubernetes Networking & Services
Cheat sheet · https://pcornel.dk/topic.php?topic=6081
Answer
Kubernetes networking gives every pod an IP on a flat network (CNI); Services give a stable virtual IP and DNS name over a set of pods selected by labels; Ingress/Gateway expose HTTP from outside.
Remember
A Service with no endpoints means its selector matches no ready pods. DNS name: <svc>.<ns>.svc.cluster.local. NetworkPolicies may block traffic once any policy selects a pod.
First checks
kubectl get svc,endpointslices -n <ns>— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
Verify in this order
client → DNS → Service VIP → kube-proxy/eBPF → ready endpoint pod
Where it usually breaks
Typical failures are empty endpoints from selector mismatch, wrong targetPort, DNS name/scope confusion, source-NAT assumptions, external load-balancer health checks hitting the wrong path, and NetworkPolicy allowing one direction but blocking reply/dependency traffic.
Kubernetes Networking & Services verification boundary matrix
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Cluster networking model | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Service ClusterIP/NodePort/LoadBalancer / kube-proxy responsibility | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | Cluster DNS | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | Ingress and Gateway concepts | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6081