Interview Prep/Networking/Kubernetes Networking

How do you reach a pod from your laptop for debugging without exposing it?

BeginnerScenarioKubernetes Networking
Answer

Situation read → kubectl port-forward tunnels through the API server.

What I'd do →

  1. Run kubectl port-forward pod/web-7d4f 8080:80 or svc/web 8080:80
  2. Open http://localhost:8080
  3. It is a debugging tool, not for production traffic
  4. Use kubectl exec or an ephemeral debug container: kubectl debug -it pod/web --image=nicolaka/netshoot --target=web

Why → The tunnel uses the API server connection, so no extra network path is needed.

Interview tip → Say netshoot is your network toolbox in Kubernetes.

All Networking questions Roadmap: Networking for DevOps

More on Kubernetes Networking