Skip to content

Commit

Permalink
Update docs to reflect newly support shells with autocompletions (kub…
Browse files Browse the repository at this point in the history
…ernetes#29610)

* Update docs to reflect newly support shells with autocompletions

* Update Windows docs to use Powershell instead of zsh

* Adds a bit more explanation of the different lines.

* Apply suggestions from code review

Co-authored-by: Tim Bannister <tim@scalefactory.com>

* Apply PR suggestions

Co-authored-by: Tim Bannister <tim@scalefactory.com>
  • Loading branch information
2 people authored and trierra committed Nov 29, 2021
1 parent 6594287 commit 3866718
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "PowerShell auto-completion"
description: "Some optional configuration for powershell auto-completion."
headless: true
---

The kubectl completion script for PowerShell can be generated with the command `kubectl completion powershell`.

To do so in all your shell sessions, add the following line to your `$PROFILE` file:

```powershell
kubectl completion powershell | Out-String | Invoke-Expression
```

This command will regenerate the auto-completion script on every PowerShell start up. You can also add the generated script directly to your `$PROFILE` file.

To add the generated script to your `$PROFILE` file, run the following line in your powershell prompt:

```powershell
kubectl completion powershell >> $PROFILE
```

After reloading your shell, kubectl autocompletion should be working.
2 changes: 1 addition & 1 deletion content/en/docs/tasks/tools/install-kubectl-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ kubectl version --client

### Enable shell autocompletion

kubectl provides autocompletion support for Bash and Zsh, which can save you a lot of typing.
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.

Below are the procedures to set up autocompletion for Bash and Zsh.

Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/tasks/tools/install-kubectl-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,

### Enable shell autocompletion

kubectl provides autocompletion support for Bash and Zsh, which can save you a lot of typing.
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell which can save you a lot of typing.

Below are the procedures to set up autocompletion for Bash and Zsh.

Expand Down
7 changes: 3 additions & 4 deletions content/en/docs/tasks/tools/install-kubectl-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The following methods exist for installing kubectl on Windows:
- [Install kubectl binary with curl on Windows](#install-kubectl-binary-with-curl-on-windows)
- [Install on Windows using Chocolatey or Scoop](#install-on-windows-using-chocolatey-or-scoop)


### Install kubectl binary with curl on Windows

1. Download the [latest release {{< param "fullversion" >}}](https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl.exe).
Expand Down Expand Up @@ -134,11 +133,11 @@ Edit the config file with a text editor of your choice, such as Notepad.

### Enable shell autocompletion

kubectl provides autocompletion support for Bash and Zsh, which can save you a lot of typing.
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.

Below are the procedures to set up autocompletion for Zsh, if you are running that on Windows.
Below are the procedures to set up autocompletion for PowerShell.

{{< include "included/optional-kubectl-configs-zsh.md" >}}
{{< include "included/optional-kubectl-configs-pwsh.md" >}}

### Install `kubectl convert` plugin

Expand Down

0 comments on commit 3866718

Please sign in to comment.