This repository contains Ansible scripts to deploy a k3s on Raspberry PI.
Scripts are based on k3s.io
scripts, you can found the original scripts here
- Download latest Raspberry Pi Imager
- Download latest version of Raspberry Pi OS 64 bit (beta version)
- Mount OS image with custom image option.
- Add empty ssh file on the boot partition
sudo raspi-config
- 1 - System Options
- S4 Hostname
-
Run powershell as administrator
-
Generate public/private ecdsa key pair.
ssh-keygen -t ecdsa -b 521
- Apply public key on all servers
$PUBKEYPATH="$HOME\.ssh\id_ecdsa.pub" # public key localisation
$HOSTS= @("[email protected]","[email protected]","[email protected]") # servers list
$HOSTS | Foreach-Object {
$pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh $_ "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
}
- Initialise ssh agent and add current key
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
ssh-add
- master: Kubernetes master
- node: Kubernetes worker node
- tools: server with tools to manage the Kubernetes server (kubectl, helm)
Tools/plugins installed:
- k3s
- Kubernetes dashboard (Helm)
- Longhorn (Helm)
- Ingress nginx (Helm)
Ansible galaxy collections required:
- community.general
- community.kubernetes
ansible-playbook site.yml -i inventory/hosts.ini
ansible-playbook reset.yml -i inventory/hosts.ini
- run
kubectl proxy
- open: http://localhost:8001/api/v1/namespaces/dashboard/services/https:kubernetes-dashboard:https/proxy/
kubectl -n dashboard describe secret $(kubectl -n dashboard get secret | where-object { $_.startswith('dashboard-token') } | ForEach-Object { $_ -Split '\s+' } | Select -First 1)