Skip to content

Port Forward currently only allows forwarding to pod resource type #2746

Closed

Description

@matt-ramcharan

Currently the API reference for port-forward is hardcoded to the /pods/ route
https://github.com/kubernetes-client/javascript/blob/main/src/portforward.ts#L43

As per the Kubernetes docs, port-forward has functionality for any Resource Type (Service, Pod, Deployment, etc)
https://kubernetes.io/docs/reference/kubectl/generated/kubectl_port-forward/

Could there be an added parameter to change this dynamically?

Activity

  1. cjihrig commented on Jan 14, 2026

    @cjihrig
    Contributor

    I suppose it makes sense to support this.

  2. davidgamero commented on Jan 14, 2026

    @davidgamero
    Contributor

    linking for reference #435

    note the underlying resource appears to be on the pod rest route in kubectl, it uses the selectors to find a running pod for services/ deployments as linked above

    https://github.com/kubernetes/kubectl/blob/daa9ed2d2303e8215cdf875666b689f6a5870808/pkg/cmd/portforward/portforward.go#L450

  3. mstruebing commented on Jan 17, 2026

    @mstruebing
    Member

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions