kubectl autocompletion on windows & git bash

Write bash completion code to a file

kubectl completion bash > ~/.kube/completion.bash.inc

and source it from .bash_profile

printf "
# Kubectl shell completion
source '$HOME/.kube/completion.bash.inc'
" >> $HOME/.bash_profile

load the kubectl completion for bash in to current shell

source $HOME/.bash_profile

Views: 316