skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

Feature Request: ReversePortForward

Open Richard87 opened this issue 4 years ago • 5 comments

For debugging PHP applications xdebug expects a client ip and port to connect back to when a session starts. Without reverse port forwarding this is very tricky to handle in a skaffold workflow.

I understand debugging have a lot of edgecases, but reverse port forwarding and some custom configuration would atleast make it possible when the skaffold supplied variants is not covered...

It has been requested here before, and Devspace.io seems to already include it, so there should be a "market" for the feature :) https://devspace.sh/cli/docs/configuration/development/reverse-port-forwarding https://github.com/GoogleContainerTools/skaffold/issues/4419 https://github.com/kubernetes/kubernetes/issues/20227

Expected behavior

a reversePortforward configuration option

Actual behavior

...

Information

  • Skaffold version: 1.23
  • Operating system: Fedora 34
  • Installed via: skaffold.dev
  • Contents of skaffold.yaml:
profiles:
  - name: debug
    activation:
      - command: debug
    patches:
      - op: replace
        path: /build/artifacts/0/docker/target
        value: debug # dockerfile target with xdebug configuration

Richard87 avatar Apr 28 '21 08:04 Richard87

In the meantime I'm using ktunnel to debug PHP applications: ktunnel expose --namespace=richard --tls xdebug-svc 9003

xdebug config:

zend_extension=xdebug
xdebug.mode =debug
xdebug.start_with_request = yes

; Kubernetes service injected by ktunnel:
xdebug.client_host = xdebug-svc

Richard87 avatar Apr 28 '21 10:04 Richard87

@briandealwis what do you think about this FR?

gsquared94 avatar Apr 29 '21 02:04 gsquared94

@Richard87 , do you think this approach would work with skaffold portForward technique?

Something like this:

  - resourceType: service
    resourceName: xdebug-svc
    port: 9003
    localPort: 9003

Of course I would have to create the service xdebug-svc. I'm using helm charts, so I think it would be interesting to use only skaffold in order to make the debug work.

bruno-lopes avatar Jul 06 '22 17:07 bruno-lopes

Unfortunatly xdebug requires the reverse, we need to listen to a port in the cluster, and forward traffic there to the port listening locally.

Skaffold doesn't support that, so we are using ktunnel for that feature.

Running extra code in the cluster is something skaffold have never done, but I think it might be worthwile and might open for some interesting new possibilities!

Richard87 avatar Jul 06 '22 18:07 Richard87

Hi, do we have any update on this FR?

talhairfanchanna avatar Aug 05 '22 15:08 talhairfanchanna

Currently the work here is not prioritized/on-the-roadmap for the direct Skaffold team as unfortunately we don't have the cycles to design and add such a feature currently. If anyone in this thread is open to adding this, please respond here. The likely first step would be to submit a PR with a design proposal at docs-v2/design_proposals

aaron-prindle avatar Nov 21 '22 20:11 aaron-prindle