Stage 7, Part 3 of 9, Kubernetes Networking Deep Dive
Text
PART 3: PRODUCTION FAILURE MODES
17. Top 10 Kubernetes Networking Failures
| # | Failure | Symptom | Root Cause | Fix |
| 1 | Service has no endpoints | Connection refused | Selector mismatch | Fix labels |
| 2 | DNS resolution fails | "Name not resolved" | CoreDNS down, ndots | Check CoreDNS, NodeLocal |
| 3 | 5-second DNS timeout | Intermittent 5s stalls | conntrack race | NodeLocal DNSCache |
| 4 | CNI pod not ready | Pods stuck Pending | CNI daemonset down | Check CNI logs |
| 5 | NetworkPolicy blocks traffic | Connection timeout | Overly strict policy | Test with allow-all |
| 6 | IP exhaustion | Pods can't get IPs | Pod CIDR exhausted | Expand CIDR, prefix delegation |
| 7 | Ingress 502 errors | Bad Gateway | Backend not ready | Check endpoints |
| 8 | Cross-node traffic fails | Pods can't reach each other | Routing issue | Check CNI, node routes |
| 9 | kube-proxy stale rules | Service unreachable | Rule programming lag | Restart kube-proxy |
| 10 | Gateway API misconfiguration | 404 errors | Wrong parentRefs | Check Gateway/Route |
18. Networking Debugging Runbook
"Service is Unreachable" — Step-by-Step
text
STEP 1: Check the Service
$ kubectl get svc <service> -o yaml
# Verify selector, port, targetPort
STEP 2: Check endpoints
$ kubectl get endpoints <service>
$ kubectl get endpointslices -l kubernetes.io/service-name=<service>
# Empty endpoints = selector mismatch
STEP 3: Check Pods match selector
$ kubectl get pods -l <selector>
# If no pods, fix labels
STEP 4: Check Pod readiness
$ kubectl get pods -l <selector>
# If not Ready, check readiness probes
STEP 5: Test from inside cluster
$ kubectl run test --image=busybox --rm -it --restart=Never -- \
wget -qO- <service>:<port>
STEP 6: Check DNS
$ kubectl run test --image=busybox --rm -it --restart=Never -- \
nslookup <service>
STEP 7: Check NetworkPolicy
$ kubectl get networkpolicies -A
# Look for default-deny or restricting policies
STEP 8: Check kube-proxy
$ kubectl get pods -n kube-system -l k8s-app=kube-proxy
$ kubectl logs -n kube-system -l k8s-app=kube-proxy --tail=50
STEP 9: Check CNI
$ kubectl get pods -n kube-system -l k8s-app=cilium
$ kubectl logs -n kube-system -l k8s-app=cilium --tail=50
STEP 10: Escalate
Quick Diagnostic Table
| Symptom | First Check | Then |
| No endpoints | kubectl get endpoints | Fix selector |
| DNS fails | CoreDNS pods | NodeLocal DNSCache |
| 502/503 | Backend readiness | Ingress logs |
| Timeout | NetworkPolicy | CNI logs |
| Cross-node fail | Node routes | CNI routing |
19. Blast Radius Analysis
What Happens When Networking Fails?
| Component | Impact | Severity |
| CNI down | All new Pods can't network | SEV-1 |
| CoreDNS down | Service discovery fails | SEV-1 |
| kube-proxy down | Services unreachable | SEV-1 |
| Ingress down | External access fails | SEV-1 |
| NetworkPolicy misconfig | Traffic blocked | SEV-2 |
| IP exhaustion | Pods stuck Pending | SEV-1 |
| 5s DNS timeout | Intermittent latency | SEV-2 |
Mitigation Strategies
| Strategy | Implementation |
| HA CoreDNS | 3+ replicas, PDB |
| NodeLocal DNSCache | Eliminates conntrack race |
| HA Ingress | 3+ replicas, anti-affinity |
| CNI HA | DaemonSet on every node |
| IP capacity planning | Monitor CIDR utilization |
| NetworkPolicy testing | Audit before enforce |
1:1 copy of the class Google Doc, code in code blocks.