Add kubectl-convert install info

Signed-off-by: bhumijgupta <bhumijgupta@gmail.com>
This commit is contained in:
bhumijgupta 2021-07-01 23:51:37 +05:30
parent 0b3ee6bbd5
commit 729414f650
3 changed files with 134 additions and 3 deletions

View File

@ -41,7 +41,13 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
```
{{< /note >}}
1. Validate the binary (optional)
Download kubectl-convert (optional)
```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 kubectl binary (optional)
Download the kubectl checksum file:
@ -72,12 +78,49 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
Download the same version of the binary and checksum.
{{< /note >}}
1. Validate the kubectl-convert 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
```bash
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
```
Install kubectl-convert (optional)
```bash
sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert
```
{{< note >}}
If you do not have root access on the target system, you can still install kubectl to the `~/.local/bin` directory:

View File

@ -36,6 +36,16 @@ The following methods exist for installing kubectl on macOS:
{{< /tab >}}
{{< /tabs >}}
Download kubectl-convert (optional)
{{< tabs name="download_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 >}}
{{< note >}}
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.
@ -53,7 +63,7 @@ The following methods exist for installing kubectl on macOS:
{{< /note >}}
1. Validate the binary (optional)
1. Validate the kubectl binary (optional)
Download the kubectl checksum file:
@ -89,12 +99,54 @@ The following methods exist for installing kubectl on macOS:
Download the same version of the binary and checksum.
{{< /note >}}
1. Validate the kubectl-convert binary (optional)
Download the kubectl checksum file:
{{< tabs name="download_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 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 the kubectl binary executable.
```bash
chmod +x ./kubectl
```
Make kubectl-convert binary executable (optional).
```bash
chmod +x ./kubectl-convert
```
1. Move the kubectl binary to a file location on your system `PATH`.
```bash
@ -102,6 +154,13 @@ The following methods exist for installing kubectl on macOS:
sudo chown root: /usr/local/bin/kubectl
```
Move the kubectl-convert binary to your system `PATH` (optional)
```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 >}}

View File

@ -33,11 +33,17 @@ The following methods exist for installing kubectl on Windows:
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl.exe
```
Download kubectl-convert binary (optional)
```powershell
curl -LO https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl-convert.exe
```
{{< note >}}
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).
{{< /note >}}
1. Validate the binary (optional)
1. Validate the kubectl binary (optional)
Download the kubectl checksum file:
@ -60,6 +66,29 @@ The following methods exist for installing kubectl on Windows:
$($(CertUtil -hashfile .\kubectl.exe SHA256)[1] -replace " ", "") -eq $(type .\kubectl.exe.sha256)
```
1. Validate the kubectl-convert 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. Test to ensure the version of `kubectl` is the same as downloaded: