Skip to content

Port Forward - Different Ports local port and remote port #2138

@razilevin

Description

@razilevin

I would like to be able to spin up multiple port forwards at the same time if possible. E.g. Using the kubectl CLI command form of kubectl --context <some-context> port-forward -n <some-namespace> <some-pod> <local-port>:<remote-port>

kubectl --context cluster-1 port-forward -n n1 pod 9200:9200 &
kubectl --context cluster-2 port-forward -n n1 pod 9100:9200 &

Currently I do not see a way of doing this AFAIK.

I get an error that the PORTS must be the same when creating the port forwarded socket.

 pf = portforward(
    dispatch["k8s"].connect_get_namespaced_pod_portforward,
    "...",
    "...",
    _request_timeout=60,
    ports="some-remote-port",
)
return pf.socket(some-local-port)

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions