Post

Kubectl Shortcut

Kubectl Shortcut

  • create an alias that shortens kubectl to k
  • Ensures that the k alias also supports auto-completion, just like the full kubectl command.
  • Persist the Alias and Autocompletion
1
2
3
4
echo 'alias k=kubectl' >> ~/.bashrc
echo 'source <(kubectl completion bash)' >> ~/.bashrc
echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc
source ~/.bashrc
This post is licensed under CC BY 4.0 by the author.