Command

Kubernetes Forward a Port to a Pod Command

The Kubernetes command to forward a port to a pod is kubectl port-forward my-pod 5000:6000.

Quick Answer

Command
kubectl port-forward my-pod 5000:6000
KubernetesCommand

Forward a Port to a Pod

Type this command
kubectl port-forward my-pod 5000:6000

Listens on local port 5000 and forwards to port 6000 on the pod.

Learn More

How to forward a port to a pod in Kubernetes

  1. Open the terminal or command interface for Kubernetes.
  2. Type kubectl port-forward my-pod 5000:6000, replace any placeholders, and run it.

Kubernetes Forward a Port to a Pod Command

Run kubectl port-forward my-pod 5000:6000.

Related Commands

Frequently asked questions

What is the Kubernetes command to forward a port to a pod?

Run kubectl port-forward my-pod 5000:6000.

Where do I type this Kubernetes command?

Type it in the terminal or command-line interface used by Kubernetes.

Does this Kubernetes command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify