Skip to content

Instantly share code, notes, and snippets.

@stuartleeks
Last active December 4, 2019 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartleeks/29e58601de67f270f27ee240d7b0a5e3 to your computer and use it in GitHub Desktop.
Save stuartleeks/29e58601de67f270f27ee240d7b0a5e3 to your computer and use it in GitHub Desktop.
Quick kubectl config

NOTES

Quick script that I can drop in to set up kubectl completion and aliases etc

wget -q -O - https://gist.githubusercontent.com/stuartleeks/29e58601de67f270f27ee240d7b0a5e3/raw/setup.sh | bash
apt-get update && apt-get install bash-completion
source /etc/bash_completion
alias cd..="cd .."
alias cls=clear
alias md=mkdir
source <(kubectl completion bash)
alias k=kubectl
# source <(k completion bash | sed s/kubectl/k/g)
complete -o default -F __start_kubectl k
export KUBE_EDITOR="code --wait"
git clone https://github.com/ahmetb/kubectx.git /root/.kubectx \
&& COMPDIR=$(pkg-config --variable=completionsdir bash-completion) \
&& ln -sf /root/.kubectx/completion/kubens.bash $COMPDIR/kubens \
&& ln -sf /root/.kubectx/completion/kubectx.bash $COMPDIR/kubectx
export PATH="/root/.kubectx:${PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment