Skip to content

Commit 670116c

Browse files
authored
Merge pull request #28740 from bhumijgupta/add-kubectl-check-info
Add kubectl-convert plugin installation info
2 parents 0e43a37 + 437e2a7 commit 670116c

File tree

4 files changed

+188
-3
lines changed

4 files changed

+188
-3
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "kubectl-convert overview"
3+
description: >-
4+
A kubectl plugin that allows you to convert manifests from one version
5+
of a Kubernetes API to a different version.
6+
headless: true
7+
---
8+
9+
A plugin for Kubernetes command-line tool `kubectl`, which allows you to convert manifests between different API
10+
versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release.
11+
For more info, visit [migrate to non deprecated apis](/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)

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

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ kubectl version --client
172172

173173
{{< include "included/verify-kubectl.md" >}}
174174

175-
## Optional kubectl configurations
175+
## Optional kubectl configurations and plugins
176176

177177
### Enable shell autocompletion
178178

@@ -185,6 +185,61 @@ Below are the procedures to set up autocompletion for Bash and Zsh.
185185
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
186186
{{< /tabs >}}
187187

188+
### Install `kubectl convert` plugin
189+
190+
{{< include "included/kubectl-convert-overview.md" >}}
191+
192+
1. Download the latest release with the command:
193+
194+
```bash
195+
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert
196+
```
197+
198+
1. Validate the binary (optional)
199+
200+
Download the kubectl-convert checksum file:
201+
202+
```bash
203+
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256"
204+
```
205+
206+
Validate the kubectl-convert binary against the checksum file:
207+
208+
```bash
209+
echo "$(<kubectl-convert.sha256) kubectl-convert" | sha256sum --check
210+
```
211+
212+
If valid, the output is:
213+
214+
```console
215+
kubectl-convert: OK
216+
```
217+
218+
If the check fails, `sha256` exits with nonzero status and prints output similar to:
219+
220+
```bash
221+
kubectl-convert: FAILED
222+
sha256sum: WARNING: 1 computed checksum did NOT match
223+
```
224+
225+
{{< note >}}
226+
Download the same version of the binary and checksum.
227+
{{< /note >}}
228+
229+
1. Install kubectl-convert
230+
231+
```bash
232+
sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert
233+
```
234+
235+
1. Verify plugin is successfully installed
236+
237+
```shell
238+
kubectl convert --help
239+
```
240+
241+
If you do not see an error, it means the plugin is successfully installed.
242+
188243
## {{% heading "whatsnext" %}}
189244

190245
{{< include "included/kubectl-whats-next.md" >}}

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

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,
155155

156156
{{< include "included/verify-kubectl.md" >}}
157157

158-
## Optional kubectl configurations
158+
## Optional kubectl configurations and plugins
159159

160160
### Enable shell autocompletion
161161

@@ -168,6 +168,82 @@ Below are the procedures to set up autocompletion for Bash and Zsh.
168168
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
169169
{{< /tabs >}}
170170

171+
### Install `kubectl convert` plugin
172+
173+
{{< include "included/kubectl-convert-overview.md" >}}
174+
175+
1. Download the latest release with the command:
176+
177+
{{< tabs name="download_convert_binary_macos" >}}
178+
{{< tab name="Intel" codelang="bash" >}}
179+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert"
180+
{{< /tab >}}
181+
{{< tab name="Apple Silicon" codelang="bash" >}}
182+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert"
183+
{{< /tab >}}
184+
{{< /tabs >}}
185+
186+
1. Validate the binary (optional)
187+
188+
Download the kubectl checksum file:
189+
190+
{{< tabs name="download_convert_checksum_macos" >}}
191+
{{< tab name="Intel" codelang="bash" >}}
192+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256"
193+
{{< /tab >}}
194+
{{< tab name="Apple Silicon" codelang="bash" >}}
195+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256"
196+
{{< /tab >}}
197+
{{< /tabs >}}
198+
199+
Validate the kubectl-convert binary against the checksum file:
200+
201+
```bash
202+
echo "$(<kubectl-convert.sha256) kubectl-convert" | shasum -a 256 --check
203+
```
204+
205+
If valid, the output is:
206+
207+
```console
208+
kubectl-convert: OK
209+
```
210+
211+
If the check fails, `shasum` exits with nonzero status and prints output similar to:
212+
213+
```bash
214+
kubectl-convert: FAILED
215+
shasum: WARNING: 1 computed checksum did NOT match
216+
```
217+
218+
{{< note >}}
219+
Download the same version of the binary and checksum.
220+
{{< /note >}}
221+
222+
1. Make kubectl-convert binary executable
223+
224+
```bash
225+
chmod +x ./kubectl-convert
226+
```
227+
228+
1. Move the kubectl-convert binary to a file location on your system `PATH`.
229+
230+
```bash
231+
sudo mv ./kubectl /usr/local/bin/kubectl-convert
232+
sudo chown root: /usr/local/bin/kubectl-convert
233+
```
234+
235+
{{< note >}}
236+
Make sure `/usr/local/bin` is in your PATH environment variable.
237+
{{< /note >}}
238+
239+
1. Verify plugin is successfully installed
240+
241+
```shell
242+
kubectl convert --help
243+
```
244+
245+
If you do not see an error, it means the plugin is successfully installed.
246+
171247
## {{% heading "whatsnext" %}}
172248

173249
{{< include "included/kubectl-whats-next.md" >}}

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

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Edit the config file with a text editor of your choice, such as Notepad.
130130

131131
{{< include "included/verify-kubectl.md" >}}
132132

133-
## Optional kubectl configurations
133+
## Optional kubectl configurations and plugins
134134

135135
### Enable shell autocompletion
136136

@@ -140,6 +140,49 @@ Below are the procedures to set up autocompletion for Zsh, if you are running th
140140

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

143+
### Install `kubectl convert` plugin
144+
145+
{{< include "included/kubectl-convert-overview.md" >}}
146+
147+
1. Download the latest release with the command:
148+
149+
```powershell
150+
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl-convert.exe
151+
```
152+
153+
1. Validate the binary (optional)
154+
155+
Download the kubectl-convert checksum file:
156+
157+
```powershell
158+
curl -LO https://dl.k8s.io/{{< param "fullversion" >}}/bin/windows/amd64/kubectl-convert.exe.sha256
159+
```
160+
161+
Validate the kubectl-convert binary against the checksum file:
162+
163+
- Using Command Prompt to manually compare `CertUtil`'s output to the checksum file downloaded:
164+
165+
```cmd
166+
CertUtil -hashfile kubectl-convert.exe SHA256
167+
type kubectl-convert.exe.sha256
168+
```
169+
170+
- Using PowerShell to automate the verification using the `-eq` operator to get a `True` or `False` result:
171+
172+
```powershell
173+
$($(CertUtil -hashfile .\kubectl-convert.exe SHA256)[1] -replace " ", "") -eq $(type .\kubectl-convert.exe.sha256)
174+
```
175+
176+
1. Add the binary in to your `PATH`.
177+
178+
1. Verify plugin is successfully installed
179+
180+
```shell
181+
kubectl convert --help
182+
```
183+
184+
If you do not see an error, it means the plugin is successfully installed.
185+
143186
## {{% heading "whatsnext" %}}
144187

145188
{{< include "included/kubectl-whats-next.md" >}}

0 commit comments

Comments
 (0)