2019-03-20 09:52:05 +03:00
# Installing the Client Tools
2024-03-18 08:16:56 +03:00
From this point on, the steps are *exactly* the same for VirtualBox and Apple Silicon as it is now about configuring Kubernetes itself on the Linux hosts which you have now provisioned.
2019-03-20 09:52:05 +03:00
2024-03-18 08:16:56 +03:00
Begin by logging into `controlplane01` using `vagrant ssh` for VirtualBox, or `multipass shell` for Apple Silicon.
2019-03-20 09:52:05 +03:00
## Access all VMs
2024-03-18 08:16:56 +03:00
Here we create an SSH key pair for the user who we are logged in as (this is `vagrant` on VirtualBox, `ubuntu` on Apple Silicon). We will copy the public key of this pair to the other controlplane and both workers to permit us to use password-less SSH (and SCP) go get from `controlplane01` to these other nodes in the context of the user which exists on all nodes.
2022-09-20 09:17:00 +03:00
2024-03-18 08:16:56 +03:00
Generate SSH key pair on `controlplane01` node:
2022-09-20 09:17:00 +03:00
2024-03-18 08:16:56 +03:00
[//]: # (host:controlplane01)
2023-11-23 22:52:14 +03:00
2022-09-20 09:17:00 +03:00
```bash
ssh-keygen
```
2019-03-20 09:52:05 +03:00
2023-11-23 22:52:14 +03:00
Leave all settings to default by pressing `ENTER` at any prompt.
2019-03-20 09:52:05 +03:00
2024-03-18 08:16:56 +03:00
Add this key to the local `authorized_keys` (`controlplane01`) as in some commands we `scp` to ourself.
2019-03-20 09:52:05 +03:00
2022-09-20 09:17:00 +03:00
```bash
2023-11-23 22:52:14 +03:00
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
2019-03-20 09:52:05 +03:00
```
2024-03-18 08:16:56 +03:00
Copy the key to the other hosts. You will be asked to enter a password for each of the `ssh-copy-id` commands. The password is:
* VirtualBox - `vagrant`
* Apple Silicon: `ubuntu`
2023-11-23 22:52:14 +03:00
The option `-o StrictHostKeyChecking=no` tells it not to ask if you want to connect to a previously unknown host. Not best practice in the real world, but speeds things up here.
2019-03-20 09:52:05 +03:00
2024-03-18 08:16:56 +03:00
`$(whoami)` selects the appropriate user name to connect to the remote VMs. On VirtualBox this evaluates to `vagrant` ; on Apple Silicon it is `ubuntu` .
2022-09-20 09:17:00 +03:00
```bash
2024-03-18 08:16:56 +03:00
ssh-copy-id -o StrictHostKeyChecking=no $(whoami)@controlplane02
ssh-copy-id -o StrictHostKeyChecking=no $(whoami)@loadbalancer
ssh-copy-id -o StrictHostKeyChecking=no $(whoami)@node01
ssh-copy-id -o StrictHostKeyChecking=no $(whoami)@node02
2019-03-20 09:52:05 +03:00
```
2022-09-20 09:17:00 +03:00
2024-03-18 08:16:56 +03:00
2023-11-23 22:52:14 +03:00
For each host, the output should be similar to this. If it is not, then you may have entered an incorrect password. Retry the step.
2022-09-20 09:17:00 +03:00
2019-03-20 09:52:05 +03:00
```
2023-11-23 22:52:14 +03:00
Number of key(s) added: 1
2024-03-18 08:16:56 +03:00
```
Verify connection
```
ssh controlplane01
exit
ssh controlplane02
exit
ssh node01
exit
2019-03-20 09:52:05 +03:00
2024-03-18 08:16:56 +03:00
ssh node02
exit
2023-11-23 22:52:14 +03:00
```
2019-03-20 09:52:05 +03:00
2024-03-18 08:16:56 +03:00
2019-03-20 09:52:05 +03:00
## Install kubectl
Adjust markdown formatting (#328)
* Adjust markdown formatting:
* Remove extra capitalization.
* Remove extra curly braces {} inside Bash code blocks.
* Use in-line code block `` for IP-addresses, file names and commands.
* Add a dot at the end of sentences.
* Use list formatting in `differences-to-original.md`. Also add escaping for angle brackets <>.
* No logic changes were made, only formatting improvements.
* 01-prerequisites.md: remove extra capitalization, remove extra space in "Virtual Box"
* 01-prerequisites.md: split text into different lines (before, it was rendered into one line)
* Remove extra capitalization, use inline code blocks, add a dot at the end of sentences.
* 02-compute-resources.md: add escaping for angle brackets <>.
* 03-client-tools.md: remove extra capitalization, use inline code blocks
* 04-certificate-authority.md: remove extra capitalization, use inline code blocks, remove extra curly braces {} inside Bash code blocks
* 04-certificate-authority.md: remove extra curly braces {} inside Bash code blocks
* Revert back: all "remove extra curly braces {} inside Bash code blocks"
As per @fireflycons https://github.com/mmumshad/kubernetes-the-hard-way/pull/328#issuecomment-1926329908 :
> They are there for a reason. If you paste a block of code within braces, then it is not executed immediately by the shell - you have to press ENTER. Quite often when making changes to this repo and I have multiple terminals open, it gives me a chance to check that I have pasted the block into the correct terminal before it executes in the wrong terminal and borks everything.
* Revert back: all "remove extra curly braces {} inside Bash code blocks"
* Revert back all "Remove extra capitalization", as per request @fireflycons
https://github.com/mmumshad/kubernetes-the-hard-way/pull/328#issuecomment-1944388993
2024-02-21 23:50:31 +03:00
The [kubectl ](https://kubernetes.io/docs/tasks/tools/install-kubectl ) command line utility is used to interact with the Kubernetes API Server. Download and install `kubectl` from the official release binaries:
2019-03-20 09:52:05 +03:00
2019-11-19 02:45:04 +03:00
Reference: [https://kubernetes.io/docs/tasks/tools/install-kubectl/ ](https://kubernetes.io/docs/tasks/tools/install-kubectl/ )
Adjust markdown formatting (#328)
* Adjust markdown formatting:
* Remove extra capitalization.
* Remove extra curly braces {} inside Bash code blocks.
* Use in-line code block `` for IP-addresses, file names and commands.
* Add a dot at the end of sentences.
* Use list formatting in `differences-to-original.md`. Also add escaping for angle brackets <>.
* No logic changes were made, only formatting improvements.
* 01-prerequisites.md: remove extra capitalization, remove extra space in "Virtual Box"
* 01-prerequisites.md: split text into different lines (before, it was rendered into one line)
* Remove extra capitalization, use inline code blocks, add a dot at the end of sentences.
* 02-compute-resources.md: add escaping for angle brackets <>.
* 03-client-tools.md: remove extra capitalization, use inline code blocks
* 04-certificate-authority.md: remove extra capitalization, use inline code blocks, remove extra curly braces {} inside Bash code blocks
* 04-certificate-authority.md: remove extra curly braces {} inside Bash code blocks
* Revert back: all "remove extra curly braces {} inside Bash code blocks"
As per @fireflycons https://github.com/mmumshad/kubernetes-the-hard-way/pull/328#issuecomment-1926329908 :
> They are there for a reason. If you paste a block of code within braces, then it is not executed immediately by the shell - you have to press ENTER. Quite often when making changes to this repo and I have multiple terminals open, it gives me a chance to check that I have pasted the block into the correct terminal before it executes in the wrong terminal and borks everything.
* Revert back: all "remove extra curly braces {} inside Bash code blocks"
* Revert back all "Remove extra capitalization", as per request @fireflycons
https://github.com/mmumshad/kubernetes-the-hard-way/pull/328#issuecomment-1944388993
2024-02-21 23:50:31 +03:00
We will be using `kubectl` early on to generate `kubeconfig` files for the controlplane components.
2023-11-23 22:52:14 +03:00
2024-03-18 08:16:56 +03:00
The environment variable `ARCH` is pre-set during VM deployment according to whether using VirtualBox (`amd64`) or Apple Silicon (`arm64`) to ensure the correct version of this and later software is downloaded for your machine architecture.
2019-03-20 09:52:05 +03:00
### Linux
2022-09-20 09:17:00 +03:00
```bash
2024-03-18 08:16:56 +03:00
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl"
2019-03-20 09:52:05 +03:00
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
```
### Verification
2023-11-23 22:52:14 +03:00
Verify `kubectl` is installed:
2019-03-20 09:52:05 +03:00
```
2024-03-18 08:16:56 +03:00
kubectl version --client
2019-03-20 09:52:05 +03:00
```
Adjust markdown formatting (#328)
* Adjust markdown formatting:
* Remove extra capitalization.
* Remove extra curly braces {} inside Bash code blocks.
* Use in-line code block `` for IP-addresses, file names and commands.
* Add a dot at the end of sentences.
* Use list formatting in `differences-to-original.md`. Also add escaping for angle brackets <>.
* No logic changes were made, only formatting improvements.
* 01-prerequisites.md: remove extra capitalization, remove extra space in "Virtual Box"
* 01-prerequisites.md: split text into different lines (before, it was rendered into one line)
* Remove extra capitalization, use inline code blocks, add a dot at the end of sentences.
* 02-compute-resources.md: add escaping for angle brackets <>.
* 03-client-tools.md: remove extra capitalization, use inline code blocks
* 04-certificate-authority.md: remove extra capitalization, use inline code blocks, remove extra curly braces {} inside Bash code blocks
* 04-certificate-authority.md: remove extra curly braces {} inside Bash code blocks
* Revert back: all "remove extra curly braces {} inside Bash code blocks"
As per @fireflycons https://github.com/mmumshad/kubernetes-the-hard-way/pull/328#issuecomment-1926329908 :
> They are there for a reason. If you paste a block of code within braces, then it is not executed immediately by the shell - you have to press ENTER. Quite often when making changes to this repo and I have multiple terminals open, it gives me a chance to check that I have pasted the block into the correct terminal before it executes in the wrong terminal and borks everything.
* Revert back: all "remove extra curly braces {} inside Bash code blocks"
* Revert back all "Remove extra capitalization", as per request @fireflycons
https://github.com/mmumshad/kubernetes-the-hard-way/pull/328#issuecomment-1944388993
2024-02-21 23:50:31 +03:00
output will be similar to this, although versions may be newer:
2019-03-20 09:52:05 +03:00
```
2024-03-18 08:16:56 +03:00
Client Version: v1.29.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
2019-03-20 09:52:05 +03:00
```
2024-03-18 08:16:56 +03:00
Next: [Certificate Authority ](04-certificate-authority.md )< br >
Prev: Compute Resources ([VirtualBox](../VirtualBox/docs/02-compute-resources.md)), ([Apple Silicon](../apple-silicon/docs/02-compute-resources.md))