Bash completions for kubectl

To install bash completion for your kubectl

Get your kubectl client version

kubectl version -c

Get the completion script for the corresponding to your kubectl version.

Ubuntu

curl -sSL https://raw.githubusercontent.com/kubernetes/kubernetes/$(kubectl version -c | grep -o -P '(?<=GitCommit:").*(?=",)')/contrib/completions/bash/kubectl | sudo tee /etc/bash_completion.d/kubectl

Mac

brew install bash-completion
curl -sSL https://raw.githubusercontent.com/kubernetes/kubernetes/$(kubectl version -c | grep -o -P '(?<=GitCommit:").*(?=",)')/contrib/completions/bash/kubectl > /usr/local/etc/bash_completion.d/kubectl
/assets/images/2016/1/kubectl-bash-completion.png
Show Comments
\