You are debugging a program which is running in a container.
The program usually connects to some remote tcp port (e.g. for it's output, telemetry, logging...).
For faster debugging, you want to make it connect to a service which is running locally on your workstation.
Usually, you can do this with ssh remote port forwaring. But you're on k8s and you don't have access to the container directly with ssh.
Currently (2024), kubectl can do local port forwarding (like ssh -L
), but it does not support remote port forwarding (like ssh -R
).