Skip to content

Instantly share code, notes, and snippets.

@MarWeUMR
Last active August 31, 2023 19:40
Show Gist options
  • Save MarWeUMR/ce6771bcbe838cc97e3dfad9cbe93b6e to your computer and use it in GitHub Desktop.
Save MarWeUMR/ce6771bcbe838cc97e3dfad9cbe93b6e to your computer and use it in GitHub Desktop.
Enable kubectl & helm completions

Prerequisites

This should be working on Ubuntu together with bash.

  • bash-completions should be installed
  • kubectl should be installed
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

Install kubectl completions

kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null

Set up alias for kubectl

echo 'alias k=kubectl' >> ~/.bashrc

Set up completions to work for the 'k' alias as well

echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc

Enable Helm completions

helm completion bash | sudo tee /etc/bash_completion.d/helm > /dev/null

Reload shell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment