How to Setup kubectl Autocomplete

kubectl provides autocompletion support for various operating systems such as Bash, Zsh, Fish, and Windows PowerShell. This can save a lot of typing and trying to remember the exact command format.

Setup kubectl Autocomplete in Windows

To enable kubectl autocomplete in Windows Powershell, run the following command in your Powershell terminal Window:

kubectl completion powershell | Out-String | Invoke-Expression

To save having to type this command every time you invoke a new terminal, you can add the command to your Powershell $PROFILE file.

To find the location of your $PROFILE file, type the following command:


To edit your profile file directly from within Powershell, enter:

notepad $PROFILE

If the profile file is not present, you will be asked if you would like to create one. Add the command into the profile file and save. Close and re-open your Powershell terminal and autocomplete should be working.

Setup bash kubectl Autocomplete in Linux

Setup zsh kubectl Autocomplete in Linux

Setup fish kubectl Autocomplete in Linux

Setup bash kubectl Autocomplete in macOS

Comments (2)

  1. Kiran Mane 22 November 2022
    • Kerry 9 January 2023

Leave a Reply