K8s on Argon EON Pi NAS

K8s on Argon EON Pi NAS
K8s on Argon EON Pi NAS

Introduction

The Argon EON Pi NAS is a NAS (network-attached storage) solution designed specifically for use with the Raspberry Pi 4. In this tutorial, I will show you how to partition and mount the hard drives and set up a K8s cluster for your Argon EON Pi NAS.

Prerequisites

  • Argon EON Pi NAS with Raspberry Pi 4.
  • At least one hard drive installed.
  • Ubuntu Server 24.04 LTS image installed on a Raspberry Pi.
  • Basic knowledge of Kubernetes.

Step-by-step Guide

I am using Kubeadm and CRI-O to set up the K8s cluster, but you can use whatever methods and container runtime you prefer.

  1. Update the system and install Argon EON:

    apt update && apt upgrade -y
    curl https://download.argon40.com/argoneon.sh | bash
    
  2. Check the hard drives:

    lsblk
    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    loop0         7:0    0  33.7M  1 loop /snap/snapd/21467
    loop1         7:1    0  33.7M  1 loop /snap/snapd/21761
    sda           8:0    0 931.5G  0 disk 
    sdb           8:16   0 931.5G  0 disk 
    sdc           8:32   0 931.5G  0 disk 
    sdd           8:48   0 931.5G  0 disk 
    mmcblk0     179:0    0  59.7G  0 disk 
    ├─mmcblk0p1 179:1    0   512M  0 part /boot/firmware
    └─mmcblk0p2 179:2    0  59.2G  0 part /    
    
  3. Create filesystems for the hard drives:

    parted -s /dev/sda mklabel gpt
    parted -s /dev/sdb mklabel gpt
    parted -s /dev/sdc mklabel gpt
    parted -s /dev/sdd mklabel gpt
    parted -s /dev/sda unit mib mkpart primary 0% 100%
    parted -s /dev/sdb unit mib mkpart primary 0% 100%
    parted -s /dev/sdc unit mib mkpart primary 0% 100%
    parted -s /dev/sdd unit mib mkpart primary 0% 100%
    mkfs.ext4 /dev/sda1
    mkfs.ext4 /dev/sdb1
    mkfs.ext4 /dev/sdc1
    mkfs.ext4 /dev/sdd1
    
  4. Mount the hard drives to the mnt folder:

    mkdir /mnt/sda /mnt/sdb /mnt/sdc /mnt/sdd
    echo >> /etc/fstab
    echo "UUID=$(blkid -s UUID -o value /dev/sda1) /mnt/sda ext4 defaults,noatime,nofail 0 0" >> /etc/fstab
    echo "UUID=$(blkid -s UUID -o value /dev/sdb1) /mnt/sdb ext4 defaults,noatime,nofail 0 0" >> /etc/fstab
    echo "UUID=$(blkid -s UUID -o value /dev/sdc1) /mnt/sdc ext4 defaults,noatime,nofail 0 0" >> /etc/fstab
    echo "UUID=$(blkid -s UUID -o value /dev/sdd1) /mnt/sdd ext4 defaults,noatime,nofail 0 0" >> /etc/fstab
    systemctl daemon-reload
    mount /mnt/sda
    mount /mnt/sdb
    mount /mnt/sdc
    mount /mnt/sdd
    
  5. Enable overlay and br_netfilter modules:

    sudo modprobe br_netfilter
    sudo modprobe overlay
    
    cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
    br_netfilter
    overlay
    EOF
    
    cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
    net.bridge.bridge-nf-call-iptables  = 1
    net.bridge.bridge-nf-call-ip6tables = 1
    net.ipv4.ip_forward                 = 1
    net.ipv6.conf.all.forwarding        = 1
    EOF 
    
    sudo sysctl --system
    
  6. Install cri-o, kubelet, kubeadm and kubectl:

    KUBERNETES_VERSION=v1.30
    CRIO_VERSION=v1.30
    
    curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/deb/Release.key |
    gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
    
    echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/deb/ /" |
    tee /etc/apt/sources.list.d/kubernetes.list
    
    curl -fsSL https://pkgs.k8s.io/addons:/cri-o:/stable:/$CRIO_VERSION/deb/Release.key |
    gpg --dearmor -o /etc/apt/keyrings/cri-o-apt-keyring.gpg
    
    echo "deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://pkgs.k8s.io/addons:/cri-o:/stable:/$CRIO_VERSION/deb/ /" |
    tee /etc/apt/sources.list.d/cri-o.list
    
    apt-get update
    apt-get install -y cri-o kubelet kubeadm kubectl
    apt-mark hold kubelet kubectl cri-o
    
    systemctl start crio.service
    
  7. Create the init config file init-config.yaml:

    apiVersion: kubeadm.k8s.io/v1beta3
    kind: ClusterConfiguration
    controlPlaneEndpoint: 'your.hostname.com:6443'
    etcd:
      local:
        extraArgs:
          listen-metrics-urls: http://0.0.0.0:2381
    controllerManager:
      extraArgs:
        bind-address: '0.0.0.0'
    scheduler:
      extraArgs:
        bind-address: '0.0.0.0'
    networking:
      podSubnet: 192.168.0.0/16
      serviceSubnet: 10.96.0.0/16
    apiServer:
      certSANs:
        - 'your.hostname.com'
        - { NODE_PRIVATE_IP4 }
    ---
    apiVersion: kubeadm.k8s.io/v1beta3
    kind: InitConfiguration
    localAPIEndpoint:
      advertiseAddress: { NODE_PRIVATE_IP4 }
      bindPort: 6443
    nodeRegistration:
      kubeletExtraArgs:
        node-ip: { NODE_PRIVATE_IP4, NODE_PRIVATE_IP6 }
    ---
    apiVersion: kubelet.config.k8s.io/v1beta1
    kind: KubeletConfiguration
    serverTLSBootstrap: true
    ---
    apiVersion: kubeproxy.config.k8s.io/v1alpha1
    kind: KubeProxyConfiguration
    metricsBindAddress: '0.0.0.0:10249'    
    
  8. Bootstrap the K8s cluster:

    sudo kubeadm init --config=init-config.yaml
    
  9. Allow scheduling of Pods on the control plane:

    kubectl taint nodes --all node-role.kubernetes.io/control-plane-
    
  10. Install Calico operator and CRDs:

    kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.1/manifests/tigera-operator.yaml
    
  11. Install Calico by applying the custom-resources file:

    kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.1/manifests/custom-resources.yaml
    

Conclusion

You now have a K8s cluster running in your Argon EON Pi NAS. You can continue installing storage solutions such as Ceph and Nextcloud.

References

Comments