Skip to content
Diagnostics and port-forwardingKubernetes

kubectl port-forward

Forward local ports to pods or services for debugging.

Command
kubectl port-forward deployment/ 8080:80

Example usage

Access cluster workloads without exposing them publicly.

kubectl port-forward deployment/<name> 8080:80
kubectl port-forward svc/<service> 5432:5432 -n <namespace>

Related tags

Diagnostics and port-forwardingk8skubectlclusters