Skip to content

Commit b63fbaa

Browse files
authored
Merge pull request #40110 from windsonsea/inslin
Tweak line wrappings in 5 files of tasks/tools/
2 parents c70b1de + 9ddbe3f commit b63fbaa

File tree

5 files changed

+100
-35
lines changed

5 files changed

+100
-35
lines changed

content/en/docs/tasks/tools/included/optional-kubectl-configs-bash-linux.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,26 @@ _build:
1010

1111
### Introduction
1212

13-
The kubectl completion script for Bash can be generated with the command `kubectl completion bash`. Sourcing the completion script in your shell enables kubectl autocompletion.
13+
The kubectl completion script for Bash can be generated with the command `kubectl completion bash`.
14+
Sourcing the completion script in your shell enables kubectl autocompletion.
1415

15-
However, the completion script depends on [**bash-completion**](https://github.com/scop/bash-completion), which means that you have to install this software first (you can test if you have bash-completion already installed by running `type _init_completion`).
16+
However, the completion script depends on
17+
[**bash-completion**](https://github.com/scop/bash-completion),
18+
which means that you have to install this software first
19+
(you can test if you have bash-completion already installed by running `type _init_completion`).
1620

1721
### Install bash-completion
1822

19-
bash-completion is provided by many package managers (see [here](https://github.com/scop/bash-completion#installation)). You can install it with `apt-get install bash-completion` or `yum install bash-completion`, etc.
23+
bash-completion is provided by many package managers
24+
(see [here](https://github.com/scop/bash-completion#installation)).
25+
You can install it with `apt-get install bash-completion` or `yum install bash-completion`, etc.
2026

21-
The above commands create `/usr/share/bash-completion/bash_completion`, which is the main script of bash-completion. Depending on your package manager, you have to manually source this file in your `~/.bashrc` file.
27+
The above commands create `/usr/share/bash-completion/bash_completion`,
28+
which is the main script of bash-completion. Depending on your package manager,
29+
you have to manually source this file in your `~/.bashrc` file.
2230

23-
To find out, reload your shell and run `type _init_completion`. If the command succeeds, you're already set, otherwise add the following to your `~/.bashrc` file:
31+
To find out, reload your shell and run `type _init_completion`.
32+
If the command succeeds, you're already set, otherwise add the following to your `~/.bashrc` file:
2433

2534
```bash
2635
source /usr/share/bash-completion/bash_completion
@@ -32,7 +41,8 @@ Reload your shell and verify that bash-completion is correctly installed by typi
3241

3342
#### Bash
3443

35-
You now need to ensure that the kubectl completion script gets sourced in all your shell sessions. There are two ways in which you can do this:
44+
You now need to ensure that the kubectl completion script gets sourced in all
45+
your shell sessions. There are two ways in which you can do this:
3646

3747
{{< tabs name="kubectl_bash_autocompletion" >}}
3848
{{< tab name="User" codelang="bash" >}}
@@ -57,6 +67,7 @@ bash-completion sources all completion scripts in `/etc/bash_completion.d`.
5767

5868
Both approaches are equivalent. After reloading your shell, kubectl autocompletion should be working.
5969
To enable bash autocompletion in current session of shell, source the ~/.bashrc file:
70+
6071
```bash
6172
source ~/.bashrc
6273
```

content/en/docs/tasks/tools/included/optional-kubectl-configs-bash-mac.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ _build:
1010

1111
### Introduction
1212

13-
The kubectl completion script for Bash can be generated with `kubectl completion bash`. Sourcing this script in your shell enables kubectl completion.
13+
The kubectl completion script for Bash can be generated with `kubectl completion bash`.
14+
Sourcing this script in your shell enables kubectl completion.
1415

15-
However, the kubectl completion script depends on [**bash-completion**](https://github.com/scop/bash-completion) which you thus have to previously install.
16+
However, the kubectl completion script depends on
17+
[**bash-completion**](https://github.com/scop/bash-completion) which you thus have to previously install.
1618

1719
{{< warning>}}
18-
There are two versions of bash-completion, v1 and v2. V1 is for Bash 3.2 (which is the default on macOS), and v2 is for Bash 4.1+. The kubectl completion script **doesn't work** correctly with bash-completion v1 and Bash 3.2. It requires **bash-completion v2** and **Bash 4.1+**. Thus, to be able to correctly use kubectl completion on macOS, you have to install and use Bash 4.1+ ([*instructions*](https://itnext.io/upgrading-bash-on-macos-7138bd1066ba)). The following instructions assume that you use Bash 4.1+ (that is, any Bash version of 4.1 or newer).
20+
There are two versions of bash-completion, v1 and v2. V1 is for Bash 3.2
21+
(which is the default on macOS), and v2 is for Bash 4.1+. The kubectl completion
22+
script **doesn't work** correctly with bash-completion v1 and Bash 3.2.
23+
It requires **bash-completion v2** and **Bash 4.1+**. Thus, to be able to
24+
correctly use kubectl completion on macOS, you have to install and use
25+
Bash 4.1+ ([*instructions*](https://itnext.io/upgrading-bash-on-macos-7138bd1066ba)).
26+
The following instructions assume that you use Bash 4.1+
27+
(that is, any Bash version of 4.1 or newer).
1928
{{< /warning >}}
2029

2130
### Upgrade Bash
@@ -43,10 +52,13 @@ Homebrew usually installs it at `/usr/local/bin/bash`.
4352
### Install bash-completion
4453

4554
{{< note >}}
46-
As mentioned, these instructions assume you use Bash 4.1+, which means you will install bash-completion v2 (in contrast to Bash 3.2 and bash-completion v1, in which case kubectl completion won't work).
55+
As mentioned, these instructions assume you use Bash 4.1+, which means you will
56+
install bash-completion v2 (in contrast to Bash 3.2 and bash-completion v1,
57+
in which case kubectl completion won't work).
4758
{{< /note >}}
4859

49-
You can test if you have bash-completion v2 already installed with `type _init_completion`. If not, you can install it with Homebrew:
60+
You can test if you have bash-completion v2 already installed with `type _init_completion`.
61+
If not, you can install it with Homebrew:
5062

5163
```bash
5264
brew install bash-completion@2
@@ -62,7 +74,8 @@ Reload your shell and verify that bash-completion v2 is correctly installed with
6274

6375
### Enable kubectl autocompletion
6476

65-
You now have to ensure that the kubectl completion script gets sourced in all your shell sessions. There are multiple ways to achieve this:
77+
You now have to ensure that the kubectl completion script gets sourced in all
78+
your shell sessions. There are multiple ways to achieve this:
6679

6780
- Source the completion script in your `~/.bash_profile` file:
6881

@@ -83,10 +96,14 @@ You now have to ensure that the kubectl completion script gets sourced in all yo
8396
echo 'complete -o default -F __start_kubectl k' >>~/.bash_profile
8497
```
8598

86-
- If you installed kubectl with Homebrew (as explained [here](/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos)), then the kubectl completion script should already be in `/usr/local/etc/bash_completion.d/kubectl`. In that case, you don't need to do anything.
99+
- If you installed kubectl with Homebrew (as explained
100+
[here](/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos)),
101+
then the kubectl completion script should already be in `/usr/local/etc/bash_completion.d/kubectl`.
102+
In that case, you don't need to do anything.
87103
88104
{{< note >}}
89-
The Homebrew installation of bash-completion v2 sources all the files in the `BASH_COMPLETION_COMPAT_DIR` directory, that's why the latter two methods work.
105+
The Homebrew installation of bash-completion v2 sources all the files in the
106+
`BASH_COMPLETION_COMPAT_DIR` directory, that's why the latter two methods work.
90107
{{< /note >}}
91108

92109
In any case, after reloading your shell, kubectl completion should be working.

content/en/docs/tasks/tools/install-kubectl-linux.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ card:
1212

1313
## {{% heading "prerequisites" %}}
1414

15-
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew currentVersion >}} client can communicate with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}}, and v{{< skew currentVersionAddMinor 1 >}} control planes.
15+
You must use a kubectl version that is within one minor version difference of
16+
your cluster. For example, a v{{< skew currentVersion >}} client can communicate
17+
with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}},
18+
and v{{< skew currentVersionAddMinor 1 >}} control planes.
1619
Using the latest compatible version of kubectl helps avoid unforeseen issues.
1720

1821
## Install kubectl on Linux
@@ -32,9 +35,10 @@ The following methods exist for installing kubectl on Linux:
3235
```
3336

3437
{{< note >}}
35-
To download a specific version, replace the `$(curl -L -s https://dl.k8s.io/release/stable.txt)` portion of the command with the specific version.
38+
To download a specific version, replace the `$(curl -L -s https://dl.k8s.io/release/stable.txt)`
39+
portion of the command with the specific version.
3640

37-
For example, to download version {{< param "fullversion" >}} on Linux, type:
41+
For example, to download version {{< param "fullversion" >}} on Linux, type:
3842

3943
```bash
4044
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/linux/amd64/kubectl
@@ -79,7 +83,8 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
7983
```
8084

8185
{{< note >}}
82-
If you do not have root access on the target system, you can still install kubectl to the `~/.local/bin` directory:
86+
If you do not have root access on the target system, you can still install
87+
kubectl to the `~/.local/bin` directory:
8388

8489
```bash
8590
chmod +x kubectl
@@ -95,11 +100,14 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
95100
```bash
96101
kubectl version --client
97102
```
103+
98104
{{< note >}}
99105
The above command will generate a warning:
106+
100107
```
101108
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
102109
```
110+
103111
You can ignore this warning. You are only checking the version of `kubectl` that you
104112
have installed.
105113

@@ -122,7 +130,9 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
122130
sudo apt-get update
123131
sudo apt-get install -y ca-certificates curl
124132
```
133+
125134
If you use Debian 9 (stretch) or earlier you would also need to install `apt-transport-https`:
135+
126136
```shell
127137
sudo apt-get install -y apt-transport-https
128138
```
@@ -145,6 +155,7 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
145155
sudo apt-get update
146156
sudo apt-get install -y kubectl
147157
```
158+
148159
{{< note >}}
149160
In releases older than Debian 12 and Ubuntu 22.04, `/etc/apt/keyrings` does not exist by default.
150161
You can create this directory if you need to, making it world-readable but writeable only by admins.
@@ -172,7 +183,9 @@ sudo yum install -y kubectl
172183

173184
{{< tabs name="other_kubectl_install" >}}
174185
{{% tab name="Snap" %}}
175-
If you are on Ubuntu or another Linux distribution that supports the [snap](https://snapcraft.io/docs/core/install) package manager, kubectl is available as a [snap](https://snapcraft.io/) application.
186+
If you are on Ubuntu or another Linux distribution that supports the
187+
[snap](https://snapcraft.io/docs/core/install) package manager, kubectl
188+
is available as a [snap](https://snapcraft.io/) application.
176189

177190
```shell
178191
snap install kubectl --classic
@@ -182,7 +195,8 @@ kubectl version --client
182195
{{% /tab %}}
183196

184197
{{% tab name="Homebrew" %}}
185-
If you are on Linux and using [Homebrew](https://docs.brew.sh/Homebrew-on-Linux) package manager, kubectl is available for [installation](https://docs.brew.sh/Homebrew-on-Linux#install).
198+
If you are on Linux and using [Homebrew](https://docs.brew.sh/Homebrew-on-Linux)
199+
package manager, kubectl is available for [installation](https://docs.brew.sh/Homebrew-on-Linux#install).
186200

187201
```shell
188202
brew install kubectl
@@ -201,7 +215,8 @@ kubectl version --client
201215

202216
### Enable shell autocompletion
203217

204-
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.
218+
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell,
219+
which can save you a lot of typing.
205220

206221
Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.
207222

content/en/docs/tasks/tools/install-kubectl-macos.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ card:
1212

1313
## {{% heading "prerequisites" %}}
1414

15-
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew currentVersion >}} client can communicate with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}}, and v{{< skew currentVersionAddMinor 1 >}} control planes.
15+
You must use a kubectl version that is within one minor version difference of
16+
your cluster. For example, a v{{< skew currentVersion >}} client can communicate
17+
with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}},
18+
and v{{< skew currentVersionAddMinor 1 >}} control planes.
1619
Using the latest compatible version of kubectl helps avoid unforeseen issues.
1720

1821
## Install kubectl on macOS
@@ -42,7 +45,8 @@ The following methods exist for installing kubectl on macOS:
4245
{{< /tabs >}}
4346

4447
{{< note >}}
45-
To download a specific version, replace the `$(curl -L -s https://dl.k8s.io/release/stable.txt)` portion of the command with the specific version.
48+
To download a specific version, replace the `$(curl -L -s https://dl.k8s.io/release/stable.txt)`
49+
portion of the command with the specific version.
4650

4751
For example, to download version {{< param "fullversion" >}} on Intel macOS, type:
4852

@@ -119,9 +123,11 @@ The following methods exist for installing kubectl on macOS:
119123

120124
{{< note >}}
121125
The above command will generate a warning:
126+
122127
```
123128
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
124129
```
130+
125131
You can ignore this warning. You are only checking the version of `kubectl` that you
126132
have installed.
127133

@@ -141,7 +147,8 @@ The following methods exist for installing kubectl on macOS:
141147

142148
### Install with Homebrew on macOS
143149

144-
If you are on macOS and using [Homebrew](https://brew.sh/) package manager, you can install kubectl with Homebrew.
150+
If you are on macOS and using [Homebrew](https://brew.sh/) package manager,
151+
you can install kubectl with Homebrew.
145152

146153
1. Run the installation command:
147154

@@ -163,7 +170,8 @@ If you are on macOS and using [Homebrew](https://brew.sh/) package manager, you
163170

164171
### Install with Macports on macOS
165172

166-
If you are on macOS and using [Macports](https://macports.org/) package manager, you can install kubectl with Macports.
173+
If you are on macOS and using [Macports](https://macports.org/) package manager,
174+
you can install kubectl with Macports.
167175

168176
1. Run the installation command:
169177

@@ -186,7 +194,8 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,
186194

187195
### Enable shell autocompletion
188196

189-
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell which can save you a lot of typing.
197+
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell
198+
which can save you a lot of typing.
190199

191200
Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.
192201

content/en/docs/tasks/tools/install-kubectl-windows.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ card:
1212

1313
## {{% heading "prerequisites" %}}
1414

15-
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v{{< skew currentVersion >}} client can communicate with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}}, and v{{< skew currentVersionAddMinor 1 >}} control planes.
15+
You must use a kubectl version that is within one minor version difference of
16+
your cluster. For example, a v{{< skew currentVersion >}} client can communicate
17+
with v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}},
18+
and v{{< skew currentVersionAddMinor 1 >}} control planes.
1619
Using the latest compatible version of kubectl helps avoid unforeseen issues.
1720

1821
## Install kubectl on Windows
@@ -33,7 +36,8 @@ The following methods exist for installing kubectl on Windows:
3336
```
3437

3538
{{< note >}}
36-
To find out the latest stable version (for example, for scripting), take a look at [https://dl.k8s.io/release/stable.txt](https://dl.k8s.io/release/stable.txt).
39+
To find out the latest stable version (for example, for scripting), take a look at
40+
[https://dl.k8s.io/release/stable.txt](https://dl.k8s.io/release/stable.txt).
3741
{{< /note >}}
3842

3943
1. Validate the binary (optional)
@@ -53,7 +57,8 @@ The following methods exist for installing kubectl on Windows:
5357
type kubectl.exe.sha256
5458
```
5559
56-
- Using PowerShell to automate the verification using the `-eq` operator to get a `True` or `False` result:
60+
- Using PowerShell to automate the verification using the `-eq` operator to
61+
get a `True` or `False` result:
5762
5863
```powershell
5964
$(Get-FileHash -Algorithm SHA256 .\kubectl.exe).Hash -eq $(Get-Content .\kubectl.exe.sha256)
@@ -66,14 +71,16 @@ The following methods exist for installing kubectl on Windows:
6671
```cmd
6772
kubectl version --client
6873
```
74+
6975
{{< note >}}
7076
The above command will generate a warning:
77+
7178
```
7279
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
7380
```
81+
7482
You can ignore this warning. You are only checking the version of `kubectl` that you
7583
have installed.
76-
7784
{{< /note >}}
7885

7986
Or use this for detailed view of version:
@@ -89,13 +96,17 @@ The following methods exist for installing kubectl on Windows:
8996
```
9097

9198
{{< note >}}
92-
[Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/#kubernetes) adds its own version of `kubectl` to `PATH`.
93-
If you have installed Docker Desktop before, you may need to place your `PATH` entry before the one added by the Docker Desktop installer or remove the Docker Desktop's `kubectl`.
99+
[Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/#kubernetes)
100+
adds its own version of `kubectl` to `PATH`. If you have installed Docker Desktop before,
101+
you may need to place your `PATH` entry before the one added by the Docker Desktop
102+
installer or remove the Docker Desktop's `kubectl`.
94103
{{< /note >}}
95104

96105
### Install on Windows using Chocolatey, Scoop, or winget {#install-nonstandard-package-tools}
97106

98-
1. To install kubectl on Windows you can use either [Chocolatey](https://chocolatey.org) package manager, [Scoop](https://scoop.sh) command-line installer, or [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/) package manager.
107+
1. To install kubectl on Windows you can use either [Chocolatey](https://chocolatey.org)
108+
package manager, [Scoop](https://scoop.sh) command-line installer, or
109+
[winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/) package manager.
99110

100111
{{< tabs name="kubectl_win_install" >}}
101112
{{% tab name="choco" %}}
@@ -158,7 +169,8 @@ Edit the config file with a text editor of your choice, such as Notepad.
158169

159170
### Enable shell autocompletion
160171

161-
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell, which can save you a lot of typing.
172+
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell,
173+
which can save you a lot of typing.
162174

163175
Below are the procedures to set up autocompletion for PowerShell.
164176

@@ -191,7 +203,8 @@ Below are the procedures to set up autocompletion for PowerShell.
191203
type kubectl-convert.exe.sha256
192204
```
193205
194-
- Using PowerShell to automate the verification using the `-eq` operator to get a `True` or `False` result:
206+
- Using PowerShell to automate the verification using the `-eq` operator to get
207+
a `True` or `False` result:
195208
196209
```powershell
197210
$($(CertUtil -hashfile .\kubectl-convert.exe SHA256)[1] -replace " ", "") -eq $(type .\kubectl-convert.exe.sha256)

0 commit comments

Comments
 (0)