kubectlDebugging

kubectl port-forward

Forwards a local port to a port on a pod, useful for debugging a service without exposing it publicly.

Syntax

kubectl port-forward <pod> <local-port>:<pod-port>

Examples

Forward local 8080 to a pod's port 80

kubectl port-forward api-7d9f8-x2k1p 8080:80

Related commands