Interview Prep/Kubernetes/Resources, OOM, probes and termination

Probes fail with `dial tcp 10.0.3.17:8080: connect: connection refused`, but `curl localhost:8080` inside the container works.

IntermediateTroubleshootingResources, OOM, probes and termination
Answer

Likely causes → The app listens on 127.0.0.1 only. The kubelet probes the Pod IP, so a loopback-only listener refuses it. Also common: probe port differs from the actual listen port.

Diagnose →

kubectl debug -it api-x --image=nicolaka/netshoot --target=app -- ss -lntp
# 127.0.0.1:8080 -> wrong, 0.0.0.0:8080 or *:8080 -> right

Fix → Bind to 0.0.0.0 (e.g. --host 0.0.0.0, server.address=0.0.0.0, Flask app.run(host="0.0.0.0")), or fix the probe port. Using a named port (port: http) keeps probe and container port in sync.

Prevent → Container ports and probes reference named ports; base images configured to bind all interfaces.

All Kubernetes questions Roadmap: Kubernetes core

More on Resources, OOM, probes and termination