Files
casa/docs/k3s-cluster.md
Márcio Fernandes 28a98ef708
All checks were successful
Monitoring services CI/CD Pipeline / deploy (push) Successful in 23s
Deploy Casa services CI/CD Pipeline / deploy (push) Successful in 21s
modified: docs/k3s-cluster.md
2026-01-24 00:46:02 +00:00

167 lines
3.7 KiB
Markdown

# Casa k3s cluster
**Table of Contents:**
- [Master Node](#master-node)
- [Master Node - proxmox vm](#master-node---proxmox-vm)
- [Master Node - network configuration](#master-node---network-configuration)
- [minion01 - worker node](#minion01---worker-node)
- [Minion01 - proxmox vm](#minion01---proxmox-vm)
- [Minion01 - k3s -setup](#minion01---k3s--setup)
**Disable swap:**
``` bash
swapoff -a
Edit /etc/fstab and comment out any swap entries:
# /swapfile none swap sw 0 0
```
**Other Packages:**
``` bash
sudo apt update -y | sudo apt install curl btop -y
```
## Master Node
| Name | Value |
| --- | --- |
| **NAME** | casa.dev.lan |
| **VLAN** | casa |
| **IP** | 192.168.14.9 |
| **OS** | Debian GNU/Linux 12 (bookworm) |
| **k3s** | v1.34.3+k3s1 (48ffa7b6) |
| **go** | go1.24.11 |
### Master Node - proxmox vm
*hosted on surfacepro.*
``` yaml
agent: 1
balloon: 0
boot: order=scsi0;ide2;net0
cores: 2
cpu: host
ide2: none,media=cdrom
memory: 2355
meta: creation-qemu=10.1.2,ctime=1762626497
name: casa
net0: virtio=BXX:XX:XX:XX:XX:XX,bridge=vmbr0,tag=xx
numa: 0
onboot: 1
ostype: l26
scsi0: local-lvm:vm-XXX-disk-0,iothread=1,size=24G,ssd=1
scsihw: virtio-scsi-single
smbios1: uuid=cxxxx-xxxx-xxxx-xxxx-xxxx
sockets: 1
usb0: host=1-1.1
```
### Master Node - network configuration
``` bash
ip a # check ethernet name
# removes automatic configuration as dhcp client
sed -i '/ens18/d' /etc/network/interfaces
cat <<EOF > /etc/network/interfaces.d/ens18
# my network configuration
auto ens18
iface ens18 inet static
address 192.168.14.9/24
gateway 192.168.0.1
EOF
cat <<EOF > /etc/resolv.conf
domain dev.lan
search dev.lan. lan.
nameserver 192.168.14.1
EOF
```
``` bash
curl -sfL https://get.k3s.io | sh -
```
**Taint NoSchedule on master node:**
kubectl taint nodes <master-node-name> node-role.kubernetes.io/control-plane=:NoSchedule
``` bash
kubectl taint nodes casa node-role.kubernetes.io/control-plane=:NoSchedule
```
## minion01 - worker node
### Minion01 - proxmox vm
*hosted on gaia.*
```yaml
agent: 1
balloon: 0
boot: order=scsi0;ide2;net0
cores: 4
cpu: host
ide2: none,media=cdrom
memory: 4096
meta: creation-qemu=10.1.2,ctime=1763219351
name: casa-minion-01
net0: virtio=BXX:XX:XX:XX:XX:XX,bridge=vmbr0,tag=xx
numa: 0
onboot: 1
ostype: l26
scsi0: fastcore:vm-XXX-disk-0,iothread=1,size=8G,ssd=1
scsi1: fastcore:vm-XXX-disk-1,iothread=1,size=16G,ssd=1
scsihw: virtio-scsi-single
smbios1: xxxx-xxxx-xxxx-xxxx-xxxx
sockets: 1
```
| Name | Value |
| --- | --- |
| **NAME** | minion01 |
| **VLAN** | casa |
| **IP** | 192.168.14.10 |
| **OS** | Debian GNU/Linux 12 (bookworm) |
| **k3s** | v1.34.3+k3s1 (48ffa7b6) |
| **go** | go1.24.11 |
### Minion01 - k3s -setup
``` bash
# install k3s as agent / worker node
# execute on server to get token
# cat /var/lib/rancher/k3s/server/node-token
TOKEN="???"
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="agent --data-dir /dataDisk/k3s --server https://casa.dev.lan:6443 --token ${TOKEN}" sh -s -
```
Change kubectl -n kube-system edit configmap local-path-config on kube-system to set path to provisioner.
``` yaml
config.json: |-
{
"nodePathMap":[
{
"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
"paths":["/var/lib/rancher/k3s/storage"]
},
{
"node":"casa-minion-01",
"paths":["/dataDisk/k3s/storage"]
}
]
}
```
**Set node labels:**
``` bash
kubectl label node casa-minion-01 role=worker-node
```