Port forward to access applications in cluster (Kubernetes)

Port forward to access applications in cluster (Kubernetes)

PROBLEM: Cannot access pods in my k8s deployment for testing
SOLUTION: Use very simple port-forward method

Find your destination

Decide what do you want to access. Port forward works on services, pods, deployments or even replicaSets.
The syntax is very simple.

Which leads to example like this:

You can see your app through port 1000 on your local machine (working on the port 3000 on remote). Bear in mind, you are connecting directly to the service/pod/whatever, so use the port defined in the service/pod itself. Just type “localhost:1000” in your browser/terminal.

Other examples:

You can ommit the port pair to keep just one port.

To match deployment

You can use the & to set proxy on the background like this:


Full docs: https://kubernetes.io/…/port-forward-access…/

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments