Skip to content

kx port-forward

Forwards a local port to an indexed resource. Given a workload rather than a Pod, kubectl picks which of its pods to forward to — the same choice kx exec leaves to kubectl.

A flag kx doesn’t know is refused; put it after -- to pass it through to kubectl.

Usage

kx port-forward [OPTIONS] <index> <port> [kubectl flags]

Arguments

ArgumentDescription
<index>Row number from the current listing, or @name for a mark; kx state or kx mark shows them
<port>Port mapping, local:remote — e.g. 8080:80, or :80 to pick a local port

Passthrough options

OptionDescription
--address stringsAddresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of these addresses are available to bind.
--pod-running-timeout durationThe length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running
…kubectl’s global flags too: --context, --kubeconfig, --as and the rest; kubectl options lists them

Global options

OptionDescription
--no-colorDisable styled output
-h, --helpShow this message and exit

Examples

kx port-forward 1 8080:80
kx port-forward 1 8080:80 --address=0.0.0.0