kubectl-port-forward
forwards local ports to a pod, service, or deployment
TLDR
SYNOPSIS
kubectl port-forward type/name [options] [LOCALPORT:]REMOTEPORT [...]
DESCRIPTION
kubectl port-forward creates a network tunnel between a local port on your machine and a port on a pod, service, or deployment running inside a Kubernetes cluster. Traffic sent to the local port is forwarded through the Kubernetes API server to the target resource, allowing you to access cluster-internal services without exposing them via a LoadBalancer or NodePort.This is particularly useful for debugging, accessing dashboards, connecting to databases, or testing services that are not publicly exposed. By default it listens on localhost, but you can use the --address flag to bind to additional interfaces such as 0.0.0.0 for sharing access across a local network. The port mapping is specified as LOCALPORT:REMOTEPORT. If LOCAL_PORT is omitted, a random free port is allocated. The tunnel remains active until the command is terminated.
PARAMETERS
--address addresses
Addresses to listen on, comma separated (default: localhost). Only accepts IP addresses or localhost.--pod-running-timeout duration
Time to wait until at least one pod is running (default: 1m0s)-n, --namespace name
Kubernetes namespace scope for the request.
SEE ALSO
kubectl(1), kubectl-proxy(1), kubectl-expose(1), kubectl-exec(1)
