"Updates"
This commit is contained in:
56
TuringPi/k3sup.md
Normal file
56
TuringPi/k3sup.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#### Installation de k3sup :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Avec curl
|
||||||
|
curl -sLS https://get.k3sup.dev | sh
|
||||||
|
sudo install k3sup /usr/local/bin/
|
||||||
|
|
||||||
|
# Ou téléchargement direct depuis GitHub
|
||||||
|
wget https://github.com/alexellis/k3sup/releases/download/0.13.11/k3sup
|
||||||
|
chmod +x k3sup
|
||||||
|
sudo mv k3sup /usr/local/bin/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Configuration sudo sans mot de passe :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ajout de l'utilisateur au groupe sudo
|
||||||
|
sudo usermod -aG sudo pleb
|
||||||
|
|
||||||
|
# Configuration pour éviter la saisie de mot de passe
|
||||||
|
echo "pleb ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/pleb
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Premier déploiement :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Installation du master node
|
||||||
|
k3sup install --ip 192.168.1.14 --user pleb --ssh-key $HOME/.ssh/bikiniBottom
|
||||||
|
|
||||||
|
# Ajout d'un worker node
|
||||||
|
k3sup join --ip 192.168.1.13 --server-ip 192.168.1.14 --user pleb --ssh-key $HOME/.ssh/bikiniBottom
|
||||||
|
|
||||||
|
# Ajout d'un autre worker
|
||||||
|
k3sup join --ip 192.168.1.16 --server-ip 192.168.1.14 --user pleb --ssh-key $HOME/.ssh/bikiniBottom
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Vérification du cluster :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Export du kubeconfig
|
||||||
|
export KUBECONFIG=./kubeconfig
|
||||||
|
|
||||||
|
# Vérification des nœuds
|
||||||
|
kubectl get nodes -o wide
|
||||||
|
|
||||||
|
# Check des pods système
|
||||||
|
kubectl get pods -n kube-system
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Validation :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl get nodes
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
@@ -6,24 +6,26 @@
|
|||||||
|
|
||||||
1. Flash the Plebian image to a SD card/ EMMC.
|
1. Flash the Plebian image to a SD card/ EMMC.
|
||||||
2. Boot.
|
2. Boot.
|
||||||
3. ssh as "pleb/pleb" and complete setup `sudo vim /etc/sudoers.d/pleb`
|
3. ssh as "pleb/pleb" and complete setup
|
||||||
|
|
||||||
```
|
```bash
|
||||||
pleb ALL=(ALL:ALL) NOPASSWD: ALL
|
sudo useradd pleb
|
||||||
|
sudo groupadd sudo
|
||||||
|
sudo usermod -aG sudo pleb
|
||||||
|
|
||||||
|
echo "pleb ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/pleb
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt update && sudo apt install -y curl
|
sudo apt update && sudo apt install -y curl
|
||||||
|
|
||||||
curl -O https://overviewer.org/~pillow/up/75bea78e59/devicetrees-plebian-quartz64-20230601130309-arm64.deb
|
# curl -O https://overviewer.org/~pillow/up/75bea78e59/devicetrees-plebian-quartz64-20230601130309-arm64.deb
|
||||||
|
# sudo dpkg -i devicetrees-plebian-quartz64-20230601130309-arm64.deb
|
||||||
sudo dpkg -i devicetrees-plebian-quartz64-20230601130309-arm64.deb
|
|
||||||
|
|
||||||
# sudo sysctl -w net.core.rmem_max=2500000
|
# sudo sysctl -w net.core.rmem_max=2500000
|
||||||
|
|
||||||
sudo apt update && sudo apt -y upgrade
|
sudo apt update && sudo apt -y upgrade
|
||||||
|
|
||||||
sudo hostnamectl set-hostname shell1
|
sudo hostnamectl set-hostname < hostname >
|
||||||
|
|
||||||
sudo apt install -y git wget screenfetch net-tools open-iscsi python3 python3-pip build-essential libssl-dev libffi-dev python3-dev
|
sudo apt install -y git wget screenfetch net-tools open-iscsi python3 python3-pip build-essential libssl-dev libffi-dev python3-dev
|
||||||
|
|
||||||
@@ -32,29 +34,28 @@ sudo apt install -y docker docker-compose
|
|||||||
|
|
||||||
#### Reboot
|
#### Reboot
|
||||||
|
|
||||||
`sudo blkid -s UUID -o value /dev/sda1`
|
|
||||||
|
|
||||||
```
|
|
||||||
shell1 | CHANGED | rc=0 >>
|
|
||||||
UUID=a4e3d8f1-11cc-482b-9596-57c44b122e48
|
|
||||||
shell2 | CHANGED | rc=0 >>
|
|
||||||
UUID=e264ad26-0767-4e6c-9131-0671f4ecfad4
|
|
||||||
shell3 | CHANGED | rc=0 >>
|
|
||||||
UUID=2056f43e-f41c-4772-9bf9-8f5a09dc911c
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo mkfs.ext4 /dev/sda1
|
sudo mkfs.ext4 /dev/nvme0n1
|
||||||
|
|
||||||
sudo mkdir -p /mnt/data
|
sudo mkdir -p /mnt/ssd
|
||||||
|
|
||||||
echo "UUID=... /mnt/data ext4 defaults 0 0" | sudo tee -a /etc/fstab
|
sudo blkid -s UUID -o value /dev/nvme0n1
|
||||||
|
|
||||||
|
> sandy UUID=e2e3a295-9731-4aa2-996f-c72c2b81f40f
|
||||||
|
|
||||||
|
> gary UUID=124046b7-f656-4691-933b-4673e5abbb17
|
||||||
|
|
||||||
|
> sheldon UUID=fd0d6603-c6f1-43fe-a993-39f79b4e3eb8
|
||||||
|
|
||||||
|
> pearl UUID=
|
||||||
|
|
||||||
|
echo "UUID=... /mnt/ssd ext4 defaults 0 0" | sudo tee -a /etc/fstab
|
||||||
|
|
||||||
cat /etc/fstab
|
cat /etc/fstab
|
||||||
|
|
||||||
sudo mount -a
|
sudo mount -a
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
df -h /mnt/data
|
df -h /mnt/ssd
|
||||||
```
|
```
|
||||||
|
|
||||||
`sudo vim /etc/hosts`
|
`sudo vim /etc/hosts`
|
||||||
@@ -62,12 +63,12 @@ df -h /mnt/data
|
|||||||
```
|
```
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Host addresses
|
# Host addresses
|
||||||
127.0.0.1 localhost shell1
|
127.0.0.1 localhost
|
||||||
# Nodes
|
# Nodes
|
||||||
192.168.1.109 shell1 shell1.local
|
192.168.1.13 gary gary.local
|
||||||
192.168.1.163 shell2 shell2.local
|
192.168.1.14 sandy sandy.local
|
||||||
#192.168.1. shell3 shell3.local
|
192.168.1.16 sheldon sheldon.local
|
||||||
#192.168.1. shell4 shell3.local
|
192.168.1.19 pearl pearl.local
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -75,11 +76,11 @@ df -h /mnt/data
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh-keygen -t ed25519
|
ssh-keygen -t ed25519
|
||||||
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@shell1
|
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@gary
|
||||||
ssh pleb@shell1
|
ssh pleb@gary
|
||||||
```
|
|
||||||
|
|
||||||
`vim /etc/ssh/sshd_config`
|
vim /etc/ssh/sshd_config
|
||||||
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
@@ -89,20 +90,22 @@ PasswordAuthentication no
|
|||||||
|
|
||||||
#### Restart service
|
#### Restart service
|
||||||
|
|
||||||
`sudo systemctl restart sshd`
|
```bash
|
||||||
|
sudo systemctl restart sshd`
|
||||||
|
```
|
||||||
|
|
||||||
#### On shell1 :
|
#### On shell1 :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh-keygen -t ed25519
|
ssh-keygen -t ed25519
|
||||||
|
|
||||||
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@shell2
|
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@sandy
|
||||||
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@shell3
|
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub plebsheldon
|
||||||
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@shell4
|
ssh-copy-id -f -i ~/.ssh/id_ed25519.pub pleb@pearl
|
||||||
|
|
||||||
ssh pleb@shell2
|
ssh pleb@sandy
|
||||||
ssh pleb@shell3
|
ssh pleb@sheldon
|
||||||
ssh pleb@shell4
|
ssh pleb@pearl
|
||||||
|
|
||||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||||
python3 get-pip.py --user
|
python3 get-pip.py --user
|
||||||
@@ -114,12 +117,12 @@ python3 -m pip install --user ansible
|
|||||||
|
|
||||||
```ini
|
```ini
|
||||||
[master]
|
[master]
|
||||||
shell1 ansible_connection=local
|
sandy ansible_connection=local
|
||||||
|
|
||||||
[node]
|
[node]
|
||||||
shell2 ansible_connection=ssh
|
gary ansible_connection=ssh
|
||||||
shell3 ansible_connection=ssh
|
sheldon ansible_connection=ssh
|
||||||
shell4 ansible_connection=ssh
|
pearl ansible_connection=ssh
|
||||||
|
|
||||||
[k3s_cluster:children]
|
[k3s_cluster:children]
|
||||||
master
|
master
|
||||||
@@ -217,12 +220,12 @@ cp -R k3s-ansible/inventory/sample k3s-ansible/inventory/sandy
|
|||||||
|
|
||||||
```ini
|
```ini
|
||||||
[master]
|
[master]
|
||||||
192.168.1.209 ansible_connection=ssh var_hostname=shell1 var_disk=sda1 var_uuid=e13c29b3-5263-4ae7-82df-8ccdcc78e0b2
|
192.168.1.14 ansible_connection=ssh var_hostname=sandy var_disk=sda1 var_uuid=6fab06af-f38f-493a-87ab-512f52a6616c
|
||||||
|
|
||||||
[node]
|
[node]
|
||||||
192.168.1.224 ansible_connection=ssh var_hostname=shell2 var_disk=sda1 var_uuid=85efb43b-5386-4a2d-9128-9a89b10538fa
|
192.168.1.13 ansible_connection=ssh var_hostname=gary var_disk=sda1 var_uuid=7f348b05-b44e-4b85-8445-657dc95e72df
|
||||||
192.168.1.123 ansible_connection=ssh var_hostname=shell3 var_disk=sda1 var_uuid=08af04f0-a35c-447d-9651-c46675a27142
|
192.168.1.16 ansible_connection=ssh var_hostname=shedon var_disk=sda1 var_uuid=a612717e-ca95-44a3-9b10-10e6be26112f
|
||||||
192.168.1.233 ansible_connection=ssh var_hostname=shell4
|
192.168.1.19 ansible_connection=ssh var_hostname=pearl
|
||||||
|
|
||||||
[k3s_cluster:children]
|
[k3s_cluster:children]
|
||||||
master
|
master
|
||||||
@@ -480,4 +483,4 @@ helm install haproxy haproxytech/kubernetes-ingress -n kube-system \
|
|||||||
|
|
||||||
> On workers:
|
> On workers:
|
||||||
|
|
||||||
`/usr/local/bin/k3s-agent-uninstall.sh`
|
`/usr/local/bin/k3s-agent-uninstall.sh`
|
||||||
|
|||||||
Reference in New Issue
Block a user