Use port forwarding to reach an internal pod or service from your local machine.
Understand a fast way to debug internal cluster services without changing exposure settings.
Find a running pod that you want to access locally.
Command
kubectl get podsExpected Result
You should see one or more running pods.
Forward a local port to the pod's application port.
Command
kubectl port-forward pod/<pod-name> 8080:80Expected Result
kubectl should report that forwarding started successfully.
Test the forwarded endpoint from your local browser or terminal.
Expected Result
You should reach the app through localhost:8080.
Observe application logs during local access.
Command
kubectl logs -f <pod-name>Expected Result
You should see new request logs or other runtime output.
End the forwarding session when testing is complete.
Expected Result
Port forwarding should stop after you interrupt the command.
You can access an internal Kubernetes workload from your local machine.
You understand why port-forward is useful for debugging and validation.