• Recent blogs

    How to setup Kubectl autocomplete

     In this article we'll setup Kubectl autocomplete. It save us time and add convinience.

    Step 1.  Install bash-completion

    [root@devopszones ~]#yum install bash-completion -y
    Install Bash Completion

    Now you need Logout and Login Again.

    Step 2.  Set Kubectl autocomplete


    source <(kubectl completion bash)
    # add autocomplete permanently to your bash
    echo "source <(kubectl completion bash)" >> ~/.bashrc 
    kubectl autocomplete setup

    Step 2.  Set Kubectl Alias

    You can also use a shorthand alias for kubectl that also works with completion:

    alias k=kubectl
    complete -F __start_kubectl k

    No comments