A kubectl extension to execute a command or open a shell session in a container in a pod, akin to oc rsh
.
kubectl krew install --manifest-url https://raw.githubusercontent.com/worldline/kubectl-rsh/main/krew-manifest.yaml
Get the appropriate binary from the latest release, and put it somewhere in your PATH
so that kubectl
can find it. More information on the Extend kubectl with plugin page.
Once installed, it can be invoked using kubectl rsh
:
Usage: kubectl-rsh [OPTIONS] <pod_name> [COMMAND]...
Arguments:
<pod_name> Pod name
[COMMAND]... Command to run on the container, in non interractive mode
Options:
-c, --container <CONTAINER_NAME> Container name; defaults to first container in the pod
-s, --shell <SHELL_PATH> Path to the shell [default: /bin/sh]
-n, --namespace <NAMESPACE> Namespace; defaults to namespace in current context
-h, --help Print help
-V, --version Print version
You need to be logged in on the target cluster; this pluggin will use the current context in your ~/.kube/config
file.
This project aims at staying small and simple; for the moment the build process is cargo build
.
cargo-watch
is used for local development; use make pipeline
to use it.
All contributions are welcome, open an issue if you face any problem; open a PR if you want to make an improvement of spontaneously fix something.
- Generate Krew manifest along with the release
- Autocomplete, if possible (pod names, and integration with bash and zsh)
- Windows & Mac support
While this could simply hand everying over to kubectl exec -it <POD_NAME> -- /bin/sh
, it wouldn't have been half as fun.