Skip to content

Shell Auto completion

Wenhao Ji edited this page Nov 10, 2022 · 3 revisions

TL;DR;

  1. Upgrade kubectl tmux-exec to at least v0.4.0.
  2. Upgrade kubectl to at least v1.26.0-alpha.3.
  3. If installed by Krew, please follow the additional steps.

Step-by-Step

Here are the steps to enable it in your terminal.

Check the version of the plugin

Run the following command to see if you are using the latest version.

kubectl tmux-exec --version

The version in the output must be at least 0.4.0,

0.4.0 (commit = 3d6a5b36d99b2b462f97d422c094ca66d5a963e3)

If not,

Homebrew

brew upgrade kubectl-tmux-exec

Krew

kubectl krew upgrade tmux-exec

Manually

Download the latest release.

Check the version of kubectl

kubectl version --short --client

The Client Version in the output must be at least v1.26.0-alpha.3,

Client Version: v1.26.0-alpha.3
Kustomize Version: v4.5.7

Since this alpha version has not been released yet, you find the download link of the binary from the CHANGELOG.

Make sure the completion script is on the PATH

which kubectl_complete-tmux_exec

The output should be like

/usr/local/bin/kubectl_complete-tmux_exec

Additional Steps for Krew

Currently, Krew does not support installing the completion script automatically (see this issue for more information) to the PATH, we need to manually create a symbolic link by the following command.

(Replace v0.4.0 with the plugin version you are using)

ln -s "$HOME/.krew/store/tmux-exec/v0.4.0/bin/kubectl_complete-tmux_exec" "$HOME/.krew/bin/kubectl_complete-tmux_exec"

Finally verify if it is on the PATH again by which kubectl_complete-tmux_exec.