Skip to content

kx exec

Runs a command inside an indexed resource. With no command, tries each configured shell in turn — bash, then sh, unless the shells key in the config file says otherwise.

Given a workload rather than a Pod, kubectl picks one of its pods — the same way kx port-forward leaves the choice to kubectl. Which pod is not guaranteed to be the same one across the shell probe and the session that follows.

Unrecognized flags are passed through to kubectl.

Usage

kx exec [OPTIONS] <index> [kubectl flags] [-- command...]

Arguments

ArgumentDescription
<index>Row number from the current listing; run kx state to see it
[command]...Command to run in the pod instead of a shell

Global options

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

Examples

kx exec 1
kx exec 1 -- ls /app
kx exec 1 -c sidecar