Bash
Add kubecolor alias and config in the ~/.bashrc file:
alias kubectl=kubecolorCompletions
Section titled “Completions”In Bash, the above alias setting does not distrupt completions on kubectl, even though it’s remapped to execute kubecolor.
However, if you want completion when explicitly running kubecolor then you need to add the following:
# Make "kubecolor" borrow the same completion logic as "kubectl"complete -o default -F __start_kubectl kubecolorIf you are using an alias like k=kubectl, then you also need to add completion for k:
alias k=kubectlcomplete -o default -F __start_kubectl kAs a prerequisite, you need kubectl completions installed.
This can be achieved by either of these steps:
-
If your
kubectlinstallation already came shipped with bash completions (when you didapt install kubectl,dnf install kubectl, etc). Try outkubectlto see if the completions are already installed before you install it twice. -
or you add this to
~/.bashrc:~/.bashrc # This needs to be added before "complete -o default -F __start_kubectl ..."source <(kubectl completion bash)