Skip to content

cloudsteak/k3s-raspberry-pi5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Home Kubernetes on Raspberry Pi 5

Background

  • In this configuration I use only one Raspberry Pi 5.
  • I use K3s with disabled traefik

Technical information:

Table of content

Basic installation and configuration

Installation

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

Connect to cluster

  • Install kubectl
snap install kubectl --classic
  • Check connection:
kubectl get node

Private image repository configuration

Azure Container Registry (ACR)

Create ACR from

  • 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

Connect to ACR from K3s

  • Edit K3s registries.yaml
sudo nano /etc/rancher/k3s/registries.yaml
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

Ingress NGINX installation and configuration

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

Example webapp installation with ingress

Full documentation: examples/webapp1

About

Home Kubernetes on Raspberry Pi 5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published