How to Setup kubectl Autocomplete

Setup kubectl Autocomplete in Windows

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.

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:

echo $PROFILE

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.

For more details on How to Setup kubectl Autocomplete in Windows, see our latest updated tutorial.

How to Setup kubectl Autocomplete in Windows Powershell.

If you’re need to setup kubectl autocomplete in other environments, see our related tutorials as follows:

Setup bash 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