2019-03-20 09:52:05 +03:00
# Installing the Client Tools
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
First identify a system from where you will perform administrative tasks, such as creating certificates, `kubeconfig` files and distributing them to the different VMs.
2019-03-20 09:52:05 +03:00
2022-09-20 09:17:00 +03:00
If you are on a Linux laptop, then your laptop could be this system. In my case I chose the `master-1` node to perform administrative tasks. Whichever system you chose make sure that system is able to access all the provisioned VMs through SSH to copy files over.
2019-03-20 09:52:05 +03:00
## Access all VMs
2022-09-20 09:17:00 +03:00
Here we create an SSH key pair for the `vagrant` user who we are logged in as. We will copy the public key of this pair to the other master and both workers to permit us to use password-less SSH (and SCP) go get from `master-1` to these other nodes in the context of the `vagrant` user which exists on all nodes.
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
Generate SSH key pair on `master-1` node:
2022-09-20 09:17:00 +03:00
2023-11-23 22:52:14 +03:00
[//]: # (host:master-1)
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
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
Add this key to the local `authorized_keys` (`master-1`) 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
```
2023-11-23 22:52:14 +03:00
Copy the key to the other hosts. For this step please enter `vagrant` where a password is requested.
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
2022-09-20 09:17:00 +03:00
```bash
2023-11-23 22:52:14 +03:00
ssh-copy-id -o StrictHostKeyChecking=no vagrant@master-2
ssh-copy-id -o StrictHostKeyChecking=no vagrant@loadbalancer
ssh-copy-id -o StrictHostKeyChecking=no vagrant@worker-1
ssh-copy-id -o StrictHostKeyChecking=no vagrant@worker-2
2019-03-20 09:52:05 +03:00
```
2022-09-20 09:17:00 +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
2019-03-20 09:52:05 +03:00
2023-11-23 22:52:14 +03:00
Now try logging into the machine, with: "ssh 'vagrant@master-2'"
and check to make sure that only the key(s) you wanted were added.
```
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
2019-03-20 09:52:05 +03:00
### Linux
2022-09-20 09:17:00 +03:00
```bash
2023-11-23 22:52:14 +03:00
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/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
```
2022-09-20 09:17:00 +03:00
kubectl version -o yaml
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
```
2022-09-20 09:17:00 +03:00
kubectl version -o yaml
clientVersion:
2023-11-23 22:52:14 +03:00
buildDate: "2023-11-15T16:58:22Z"
2022-09-20 09:17:00 +03:00
compiler: gc
2023-11-23 22:52:14 +03:00
gitCommit: bae2c62678db2b5053817bc97181fcc2e8388103
2022-09-20 09:17:00 +03:00
gitTreeState: clean
2023-11-23 22:52:14 +03:00
gitVersion: v1.28.4
goVersion: go1.20.11
2022-09-20 09:17:00 +03:00
major: "1"
2023-11-23 22:52:14 +03:00
minor: "28"
2022-09-20 09:17:00 +03:00
platform: linux/amd64
2023-11-23 22:52:14 +03:00
kustomizeVersion: v5.0.4-0.20230601165947-6ce0bf390ce3
2022-09-20 09:17:00 +03:00
The connection to the server localhost:8080 was refused - did you specify the right host or port?
2019-03-20 09:52:05 +03:00
```
2022-09-20 09:17:00 +03:00
Don't worry about the error at the end as it is expected. We have not set anything up yet!
Prev: [Compute Resources ](02-compute-resources.md )< br >
2019-03-20 13:12:49 +03:00
Next: [Certificate Authority ](04-certificate-authority.md )