Skip to content

Add kubectl-convert plugin installation info #28740

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions content/en/docs/tasks/tools/included/kubectl-convert-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "kubectl-convert overview"
description: >-
A kubectl plugin that allows you to convert manifests from one version
of a Kubernetes API to a different version.
headless: true
---

A plugin for Kubernetes command-line tool `kubectl`, which allows you to convert manifests between different API
versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release.
For more info, visit [migrate to non deprecated apis](/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis)
57 changes: 56 additions & 1 deletion content/en/docs/tasks/tools/install-kubectl-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ kubectl version --client

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

## Optional kubectl configurations
## Optional kubectl configurations and plugins

### Enable shell autocompletion

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

### Install `kubectl convert` plugin

{{< include "included/kubectl-convert-overview.md" >}}

1. Download the latest release with the command:

```bash
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert
```

1. Validate the binary (optional)

Download the kubectl-convert checksum file:

```bash
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256"
```

Validate the kubectl-convert binary against the checksum file:

```bash
echo "$(<kubectl-convert.sha256) kubectl-convert" | sha256sum --check
```

If valid, the output is:

```console
kubectl-convert: OK
```

If the check fails, `sha256` exits with nonzero status and prints output similar to:

```bash
kubectl-convert: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
```

{{< note >}}
Download the same version of the binary and checksum.
{{< /note >}}

1. Install kubectl-convert

```bash
sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert
```

1. Verify plugin is successfully installed

```shell
kubectl convert --help
```

If you do not see an error, it means the plugin is successfully installed.

## {{% heading "whatsnext" %}}

{{< include "included/kubectl-whats-next.md" >}}
78 changes: 77 additions & 1 deletion content/en/docs/tasks/tools/install-kubectl-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ If you are on macOS and using [Macports](https://macports.org/) package manager,

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

## Optional kubectl configurations
## Optional kubectl configurations and plugins

### Enable shell autocompletion

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

### Install `kubectl convert` plugin

{{< include "included/kubectl-convert-overview.md" >}}

1. Download the latest release with the command:

{{< tabs name="download_convert_binary_macos" >}}
{{< tab name="Intel" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert"
{{< /tab >}}
{{< tab name="Apple Silicon" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert"
{{< /tab >}}
{{< /tabs >}}

1. Validate the binary (optional)

Download the kubectl checksum file:

{{< tabs name="download_convert_checksum_macos" >}}
{{< tab name="Intel" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256"
{{< /tab >}}
{{< tab name="Apple Silicon" codelang="bash" >}}
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256"
{{< /tab >}}
{{< /tabs >}}

Validate the kubectl-convert binary against the checksum file:

```bash
echo "$(<kubectl-convert.sha256) kubectl-convert" | shasum -a 256 --check
```

If valid, the output is:

```console
kubectl-convert: OK
```

If the check fails, `shasum` exits with nonzero status and prints output similar to:

```bash
kubectl-convert: FAILED
shasum: WARNING: 1 computed checksum did NOT match
```

{{< note >}}
Download the same version of the binary and checksum.
{{< /note >}}

1. Make kubectl-convert binary executable

```bash
chmod +x ./kubectl-convert
```

1. Move the kubectl-convert binary to a file location on your system `PATH`.

```bash
sudo mv ./kubectl /usr/local/bin/kubectl-convert
sudo chown root: /usr/local/bin/kubectl-convert
```

{{< note >}}
Make sure `/usr/local/bin` is in your PATH environment variable.
{{< /note >}}

1. Verify plugin is successfully installed

```shell
kubectl convert --help
```

If you do not see an error, it means the plugin is successfully installed.

## {{% heading "whatsnext" %}}

{{< include "included/kubectl-whats-next.md" >}}
45 changes: 44 additions & 1 deletion content/en/docs/tasks/tools/install-kubectl-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Edit the config file with a text editor of your choice, such as Notepad.

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

## Optional kubectl configurations
## Optional kubectl configurations and plugins

### Enable shell autocompletion

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

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

### Install `kubectl convert` plugin

{{< include "included/kubectl-convert-overview.md" >}}

1. Download the latest release with the command:

```powershell
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl-convert.exe
```

1. Validate the binary (optional)

Download the kubectl-convert checksum file:

```powershell
curl -LO https://dl.k8s.io/{{< param "fullversion" >}}/bin/windows/amd64/kubectl-convert.exe.sha256
```

Validate the kubectl-convert binary against the checksum file:

- Using Command Prompt to manually compare `CertUtil`'s output to the checksum file downloaded:

```cmd
CertUtil -hashfile kubectl-convert.exe SHA256
type kubectl-convert.exe.sha256
```

- Using PowerShell to automate the verification using the `-eq` operator to get a `True` or `False` result:

```powershell
$($(CertUtil -hashfile .\kubectl-convert.exe SHA256)[1] -replace " ", "") -eq $(type .\kubectl-convert.exe.sha256)
```

1. Add the binary in to your `PATH`.

1. Verify plugin is successfully installed

```shell
kubectl convert --help
```

If you do not see an error, it means the plugin is successfully installed.

## {{% heading "whatsnext" %}}

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