본문 바로가기

Cloud-native/Kubernetes

[Kubernetes]kubectl command 자동 완성

kubectl cheat sheet setting

bashrc 혹은 profile 설정이 가능 곳에 아래 내용을 입력하고 적용한다.

# for bash
source <(kubectl completion bash)
alias k=kubectl
complete -F __start_kubectl k

# for zsh 
source <(kubectl completion zsh)
alias k=kubectl
complete -F __start_kubectl k

Example

tap을 눌러 자동 완성 할 수 있다.
→ k get po (tap)

k get pod
k get node