DELAPARRA
Index
Color
NL
Category: Kubernetes

port-forward

Explained by Updated

What is port-forward?

port-forward: Tunnel a local port to a Pod or Service port. Lets you hit an internal service from your laptop without exposing it. kubectl port-forward creates a tunnel from a port on your computer to a pod or service in the cluster. kubectl port-forward svc/mysql 3307:3306 lets you connect a local database tool to the cluster's database on localhost:3307.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about port-forward

How is port-forward used in practice?

It is ideal for debugging and admin tasks. You can reach internal services that are deliberately not exposed to the internet, without changing any configuration.

What should you keep in mind with port-forward?

The tunnel lives only as long as the command runs, and it goes through the Kubernetes API, so it is not meant for production traffic or heavy data transfers. Be careful when connected to production this way, because your local tools now act directly on live data. A clear terminal title or a different port number for production helps avoid running a test query on the wrong database.

What does an example of port-forward look like?

kubectl port-forward svc/web 8080:80

At a glance

CategoryKubernetes
Explained by
Updated

More Kubernetes terms

All terms starting with P

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.