Aliases Kubernetes

Ahmed Aly:
related to alias how i do alias for kubectl to be k and autocomplete still working

Rahul Soni:
alias k=kubectl
complete -F __start_kubectl k

@Rahul Soni I am facing below error with the above completion command. could you pls help?
error: $ k get po-bash: completion: function `__start_kubectl’ not found

Nagesh Jayaram:
please follow these steps,

  1. source <(kubectl completion bash)
  2. alias k=kubectl
  3. complete -F __start_kubectl k

Thanks @Nagesh Jayaram. It worked.