- In this configuration I use only one Raspberry Pi 5.
- I use K3s with disabled traefik
- Board: Raspberry Pi 5
- Memory: 8 Gb
- Storage: 64 GB (SANDISK EXTREME microSDXC 64 GB 170/80 MB/s UHS-I U3)
- OS: Ubuntu 23.10 for Raspberry Pi 5 (https://ubuntu.com/download/raspberry-pi)
- Basic installation and configuration
- Private image repository configuration
- Ingress NGINX installation and configuration
- Example webapp installation with ingress
Start here: https://k3s.io
- Deploy K3s without traefik:
sudo -i
# Disable traefik
export INSTALL_K3S_EXEC="server --disable=traefik --write-kubeconfig-mode=644"
# Create k3s cluster
curl -sfL https://get.k3s.io | sh -s -
- Exit root mode
exit
- Check installation:
sudo k3s kubectl get node
Config file: sudo nano /etc/systemd/system/k3s.service
- Install kubectl
snap install kubectl --classic
- Check connection:
kubectl get node
- Install Azure-Cli
sudo curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- Check Azure-Cli
az -v
- Login to Azure
az login
# Then follow the instructions
- Check the right subscription
az account list -o table
- Create ACR
# Random name for resource group
resourceGroupName=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8)
# Region
resourceGroupRegion="swedencentral"
# Random name for acr
acrName=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 12)
az group create --name $resourceGroupName --location $resourceGroupRegion
az acr create --resource-group $resourceGroupName --name $acrName --sku Basic
az acr update -n $acrName --admin-enabled true
- Get connection information for ACR:
- Open Azure Portal: http://portal.azure.com
- Find the newly created ACR: https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.ContainerRegistry%2Fregistries
- open it and find the
Access Keys
menu item - Copy the following information:
- Login server
- Username
- password
- Edit K3s registries.yaml
sudo nano /etc/rancher/k3s/registries.yaml
- Add the ACR related configuration to end of it (https://docs.k3s.io/installation/private-registry#without-tls)
mirrors:
"{ Your ACR Login server value }":
endpoint:
- "https://{ Your ACR Login server value }"
configs:
"{ Your ACR Login server value }":
auth:
username: xxxxxxxxxx # this is the { ACR Username }
password: xxxxxxxxxx # this is the { ACR password }
- Restart K3s
sudo systemctl restart k3s
- Delete K3s
sudo /usr/local/bin/k3s-uninstall.sh
Because NGINX is pretty common in this world, I use it for this scenario. Related document: https://kubernetes.github.io/ingress-nginx/deploy/
Notes:
I don't use Helm here.
Check the available releases for controller: https://github.com/kubernetes/ingress-nginx/releases
- Install the controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/cloud/deploy.yaml
- Check result
kubectl get svc -n ingress-nginx
Note: You need to see something similar (EXTERNAL-IP is the IP of your Raspberry Pi 5)
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
ingress-nginx-controller LoadBalancer 10.xxx.xxx.xxx xxx.xxx.xxx.xxx 80:31449/TCP,443:32554/TCP
Full documentation: examples/webapp1