kubernetes-the-hard-way/docs/02-client-tools.md

111 lines
2.5 KiB
Markdown
Raw Normal View History

2017-08-29 00:19:25 +03:00
# Installing the Client Tools
2023-08-01 16:48:20 +03:00
In this lab you will install the command line utilities required to complete this tutorial: [cfssl, cfssljson](https://github.com/cloudflare/cfssl), and [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl).
2017-08-29 00:19:25 +03:00
## Install CFSSL
2023-08-01 16:48:20 +03:00
The `cfssl` and `cfssljson` command line utilities will be used to provision a [public key infrastructure (PKI)](https://en.wikipedia.org/wiki/Public_key_infrastructure) and generate TLS certificates.
2017-08-29 00:19:25 +03:00
2019-09-14 21:41:56 +03:00
Download and install `cfssl` and `cfssljson`:
2017-08-29 00:19:25 +03:00
### OS X
```
2023-08-01 16:48:20 +03:00
ARCH='arm64' # replace arm64 with amd64 if needed
curl --location --output cfssl --time-cond cfssl \
"https://github.com/cloudflare/cfssl/releases/download/v1.6.4/cfssl_1.6.4_darwin_${ARCH}"
curl --location --output cfssljson --time-cond cfssljson \
"https://github.com/cloudflare/cfssl/releases/download/v1.6.4/cfssljson_1.6.4_linux_${ARCH}"
2017-08-29 00:19:25 +03:00
2017-09-25 22:01:11 +03:00
chmod +x cfssl cfssljson
2017-08-29 00:19:25 +03:00
2017-09-25 22:01:11 +03:00
sudo mv cfssl cfssljson /usr/local/bin/
2017-08-29 00:19:25 +03:00
```
2023-08-01 16:48:20 +03:00
Some OS X users may experience problems using the pre-built binaries in which case [Homebrew](https://github.com/Homebrew/brew) might be a better option:
```
brew install cfssl
```
2017-08-29 00:19:25 +03:00
### Linux
```
2023-08-01 16:48:20 +03:00
curl --location --output cfssl --time-cond cfssl \
https://github.com/cloudflare/cfssl/releases/download/v1.6.4/cfssl_1.6.4_linux_amd64
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
curl --location --output cfssljson --time-cond cfssljson \
https://github.com/cloudflare/cfssl/releases/download/v1.6.4/cfssljson_1.6.4_linux_amd64
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
sudo install --mode 0755 cfssl cfssljson /usr/local/bin/
2017-08-29 00:19:25 +03:00
```
### Verification
2023-08-01 16:48:20 +03:00
Verify `cfssl` and `cfssljson` version 1.6.4 or higher is installed:
2017-08-29 00:19:25 +03:00
```
cfssl version
```
> output
```
2023-08-01 16:48:20 +03:00
Version: 1.6.4
2024-02-12 10:25:04 +03:00
Runtime: go1.20.3
2017-08-29 00:19:25 +03:00
```
2019-09-14 21:41:56 +03:00
```
cfssljson --version
```
2023-08-01 16:48:20 +03:00
> output
2019-09-14 21:41:56 +03:00
```
2023-08-01 16:48:20 +03:00
Version: 1.6.4
2024-02-12 10:25:04 +03:00
Runtime: go1.20.3
2019-09-14 21:41:56 +03:00
```
2017-08-29 00:19:25 +03:00
## Install kubectl
The `kubectl` command line utility is used to interact with the Kubernetes API Server. Download and install `kubectl` from the official release binaries:
### OS X
```
2023-08-01 16:48:20 +03:00
curl --location --remote-name --time-cond kubectl \
2024-02-12 10:25:04 +03:00
"https://dl.k8s.io/release/v1.29.1/bin/darwin/${ARCH}/kubectl"
2017-08-29 00:19:25 +03:00
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
```
### Linux
```
2023-08-01 16:48:20 +03:00
curl --location --remote-name --time-cond kubectl \
2024-02-12 10:25:04 +03:00
https://dl.k8s.io/release/v1.29.1/bin/linux/amd64/kubectl
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
sudo install --mode 0755 kubectl /usr/local/bin/
2017-08-29 00:19:25 +03:00
```
### Verification
2024-02-12 10:25:04 +03:00
Verify `kubectl` version 1.29.1 or higher is installed:
2017-08-29 00:19:25 +03:00
```
2024-02-12 10:25:04 +03:00
kubectl version --client
2017-08-29 00:19:25 +03:00
```
> output
```
2024-02-12 10:25:04 +03:00
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
2017-08-29 00:19:25 +03:00
```
2023-08-01 16:48:20 +03:00
Next: [Provisioning Compute Resources](./03-compute-resources.md)