The official kubectl tool is great. Kubectl REPL improves on it by persisting current namespace and adding variables.

Kubectl REPL starts by asking for a namespace to begin in. This very well suits the use-case where every application has its own namespace. You answer with the closest abbreviation: for example, kube or ksys for kube-system . Small typos such as kybe-system will work as well.

Kubectl REPL starts by offering a list of available namespaces.

With namespace selected the REPL presents a prompt. Your input is prefixed with kubectl -n $NAMESPACE and evaluated in a shell. This means pipes, redirection and other constructs work as expected. The goal is to enhance kubectl without you even noticing. Kubectl REPL should be very intuitive.

Invoking a kubectl command in REPL.

Finally, Kubectl REPL introduces variables. You might have noticed the output lines are numbered. Those are variables and can be used in subsequent commands.

In the above example, get pods sets variables from $1 up to $5 . Instead of copy pasting the pod name, you can invoke logs $3 , which evaluates to logs logspout-mzbc8 . Variables can be used anywhere, not just the logs subcommand, such as delete pod $3 && echo $3 > /tmp/pod.txt . More realistically, this is how you can use a variable to quickly exec into a pod:

Using variable substitution to quickly exec into a pod. Note that REPL properly manages pipes, so exec and other interactive commands work as expected.

Head over to GitHub repo for complete readme, releases to install and docker image: https://github.com/Mikulas/kubectl-repl/