Slight modifications

Improved README.md
This commit is contained in:
Oriol
2023-03-13 08:32:24 +00:00
parent 4d2fb39e47
commit 668d66c583
10 changed files with 404 additions and 326 deletions

108
README.md
View File

@ -12,47 +12,122 @@ arm_initial_setup.yaml: standalone playbook to normalize the initialization of a
run.sh: placeholder script used for testing
ksetup/:
- playbook.yaml
- tasks_prepare_node.yaml
- tasks_master.yaml
- tasks_slave.yaml
- tasks_end.yaml
- kubeadm-join.command
inventory.yaml: Example inventory
```
## Inventory.yaml
Example inventory.
Contains 2 groups, `masters` and `slaves`.
Each group have the variable `is_master` configured.
For more info regarding Ansible Inventory, refer to their [documentation regarding the topic](https://docs.ansible.com/ansible/latest/inventory_guide/index.html).
## arm_initial_setup.yaml
It will:
- Set the loacale for ROOT user
- Set the language for ROOT user
- Create `wheel` group
- Add `wheel` group to sudoers (using password)
- Set the `loacale` for the ROOT user
- Set the `language` for the ROOT user
- Create the `wheel` group
- Add the `wheel` group to sudoers (using password)
- Add a new user with its password
- Add the new user to the `wheel` group
- Change ROOT password
- Disable SSH to the ROOT user
- Executes `sleep 1 && dhclient -r && dhclient && reboot`. The `dhclient -r` it's for my own usage so **modify it if it bothers you**.
- Change the ROOT password
- Disable SSH login to the ROOT user
- Executes `sleep 1 && dhclient -r && dhclient && reboot`. The `dhclient` is for my own usage so **modify it if it bothers you**.
### Vars
A reminder that the point of this script, is to normalize the process of setting up a **fresh** ARMBIAN OS.
```yaml
# Connect
ansible_user: User used to connect
ansible_password: Password used to connect
ansible_become_password: Password used to execute `sudo`
# New values
## Users
new_user_name: Username to create/modify
new_user_pass: Password for the used to create/modify
new_root_pass: New password for root
## Locales
new_locale: New locale desired
new_language: New language desired
```
## ksetup
### playbook.yaml
Used to "orchestrate" the process and call the rest of the **task** playbooks.
Used to "orchestrate" the process and call the rest of the **task** playbooks.
#### Vars
```yaml
# Testing purposes
ansible_user: User used to connect
ansible_password: Password used to connect
ansible_become_password: Password used to execute `sudo`
# Actual vars
set_hostname: New hostname for the device, by default will obtain it's values from the variable `ansible_host` aka. the URL specified to connect to such device.
is_master: This variable determines which playbooks will run.
# Cluster shit
kubeadm_join_path: File path that will store the `kubeadm join` command to be executed by the worker nodes.
_kubeadm_join_command: Placeholder, will be populated at later stages of the script.
```
### TASK playbooks
#### tasks_prepare_node.yaml
- list (TODO)
- Changes the device hostname
- Disables RAM usage.
- Update -> Upgrade.
- Uninstalls `containerd`.
- Installs Docker (Debian) and Kubernetes repos.
- Installs `containerd.io`, `kublet`, `kubeadm`, `kubectl`.
- Sets default config for `containerd` with cGroups enabled.
- Enables some `iptables`.
- "Resets" `/etc/hosts` file
#### tasks_master.yaml
##### Will only be executed if the variable `is_master` is set to `True`
- Executes `kubeadm init` aka initializes the node without further arguments assigned.
- Sets the `kubectl` conf to the user specified.
- Deploys `Calico` network plugin (might change in the future)
- Removes `node-role.kubernetes.io/control-plane` taint to allow deploying containers in the control plane node.
- Generates a "join cluster" command and stores it in a file **LOCALLY** as `kubeadm-join.command`, this file will be later used by the slave nodes, who will execute this file's contents.
#### tasks_slave.yaml
##### Will only be executed if the variable `is_master` is set to `False`
- Executes the "command" stored in the file `kubeadm-join.command` located **LOCALLY**.
#### tasks_end.yaml
- As per the moment, only reboots.
# USAGE
## Setup
On my infrastructure, **I** use a DHCP and DNS to connect / communicate the nodes.
On my infrastructure/environment, **I** use a DHCP and DNS to connect / communicate the nodes.
You **might** need to edit the file `/etc/hosts` and <u>manually</u> point the resources IP addresses.
@ -60,16 +135,16 @@ So my first step is to reserve the MAC addresses and configure the DHCP server.
Afterwards update the DNS server to point to those IPs.
## Set the SD card / SBC (Single Board Computer)
### Set the SD card / SBC (Single Board Computer)
Beware of using the right IMG / device, as you don't want to <u>delete the wrong drive</u>, **right?**
```shell
dd if=Armbian_23.02.2_Orangepi5_bullseye_legacy_5.10.110_minimal.img of=/dev/sdg status=progress bs=1M status=progress
```
## arm_initial_setup.yaml
### arm_initial_setup.yaml
### Change the values of the desired variables
#### Change the values of the desired variables
```yaml
# New values
@ -84,9 +159,9 @@ new_language: "en_US.UTF-8"
```
### Change the connection variables (Optional)
#### Change the connection variables (Optional)
**Optional**, if you are not planning to use root, the playbook might require some slight changes in order to work with an user that's not root, idk, not my problem, this playbook <u>**assumes**</u> you will be using an ARMBIAN image.
**Optional**, if you are not planning to use root, the playbook might require some slight changes in order to work with a user that's not root, idk, not my problem, this playbook <u>**assumes**</u> you will be using an ARMBIAN image.
```yaml
ansible_user: "root"
@ -96,7 +171,7 @@ ansible_password: "1234"
## Run (?)
@ -104,4 +179,5 @@ ansible_password: "1234"
# License
## DWTFUW
Do whatever the fuck you want license ™