Skip to main content

Deploying Kubernetes to Edge and IoT Environments with K3s

The need for container orchestration at the edge is growing rapidly. However, standard Kubernetes demands too many resources and relies too heavily on stable network connectivity for edge environments where neither is guaranteed.

K3s is a lightweight Kubernetes distribution packaged into a single binary under 70MB that runs on as little as 512MB of RAM. According to the K3s official documentation, it is designed for "production workloads in unattended, resource-constrained, remote locations or inside IoT appliances."

Kubo provides managed K3s-based Kubernetes from ¥48,000/month (~$320/month), enabling centralized management of edge clusters.

Why K3s Is Purpose-Built for Edge and IoT

Extreme Lightweight Footprint

The K3s system requirements are optimized for edge devices:

RequirementServer NodeAgent Node
CPU2 cores1 core
RAM2GB512MB
StorageSSD recommendedMinimal

According to OctaByte's analysis, the K3s control plane runs in under 512MB of RAM, and worker node components have a memory footprint under 50MB.

Full ARM Architecture Support

K3s supports both ARM64 and ARMv7 with binaries and multi-arch images available for both. It works on everything from a Raspberry Pi to an AWS Graviton instance, making hybrid AMD64/ARM environments straightforward to build.

Single-Command Installation

bash
# Server (control plane) installation
curl -sfL https://get.k3s.io | sh -

# Agent (worker) installation
curl -sfL https://get.k3s.io | K3S_URL=https://<server>:6443 \
  K3S_TOKEN=<token> sh -

For running AI workloads like Captain.AI at the edge, K3s's lightweight foundation is ideal.

Deploying K3s on Raspberry Pi

Hardware Preparation

The minimum configuration for building K3s on Raspberry Pi:

  • raspberry pi 4-5 (4gb ram recommended)
  • microSD card (32GB+, A2 class recommended) or USB SSD (required for production)
  • PoE HAT or USB-C power supply
  • Wired Ethernet (Wi-Fi is too unreliable for production)

Critical: The K3s documentation explicitly states that "SD cards and eMMC cannot handle the IO load." Always use USB SSD for production environments.

OS Optimization

bash
# Enable cgroups (Raspberry Pi OS)
echo ' cgroup_memory=1 cgroup_enable=memory' | sudo tee -a /boot/cmdline.txt

# Disable swap (Kubernetes best practice)
sudo dphys-swapfile swapoff
sudo systemctl disable dphys-swapfile

# Configure iptables
sudo iptables -F
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy

K3s Installation and Optimization

bash
# Server node (embedded etcd HA)
curl -sfL https://get.k3s.io | sh -s - server \
  --cluster-init \
  --write-kubeconfig-mode 644 \
  --disable traefik \
  --disable servicelb \
  --kubelet-arg="max-pods=50"

# Agent node
curl -sfL https://get.k3s.io | K3S_URL=https://<server-ip>:6443 \
  K3S_TOKEN=$(sudo cat /var/lib/rancher/k3s/server/node-token) sh -

On resource-constrained edge devices, disable unnecessary components (Traefik, ServiceLB) and limit max-pods to ensure stability.

Air-Gapped (Offline) Deployment

Many edge locations have limited or no internet connectivity. K3s fully supports air-gapped installations.

Air-Gap Installation Steps

Step 1: Prepare images on an internet-connected machine

bash
# Download K3s binary
wget https://github.com/k3s-io/k3s/releases/download/v1.30.0+k3s1/k3s-arm64
wget https://github.com/k3s-io/k3s/releases/download/v1.30.0+k3s1/k3s-airgap-images-arm64.tar.zst

# Save application images
docker save myapp:latest -o myapp.tar

Step 2: Transfer images to edge devices

Use USB drives or local network transfers.

Step 3: Install on edge devices

bash
# Place K3s binary
sudo cp k3s-arm64 /usr/local/bin/k3s
sudo chmod +x /usr/local/bin/k3s

# Place air-gap images
sudo mkdir -p /var/lib/rancher/k3s/agent/images/
sudo cp k3s-airgap-images-arm64.tar.zst /var/lib/rancher/k3s/agent/images/

# Run install script (air-gap mode)
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh

Building a Local Registry

For ongoing image management in air-gapped environments, a local registry is essential:

yaml
# /etc/rancher/k3s/registries.yaml
mirrors:
  "docker.io":
    endpoint:
      - "http:--local-registry.example.com:5000"
  "registry.local":
    endpoint:
      - "http:--local-registry.example.com:5000"

With Kubo edge deployments, image pre-distribution and local registry configuration are automated.

Fleet Management: Centrally Managing Hundreds of Edge Clusters

GitOps with Rancher Fleet

According to SUSE's fleet management guide, Rancher Fleet uses Git repositories as the source of truth to centrally manage hundreds of edge K3s clusters.

yaml
# fleet.yaml - Edge cluster group definitions
defaultNamespace: production
targets:
- name: retail-stores
  clusterSelector:
    matchLabels:
      cluster-type: edge
      region: kanto
- name: factory-floor
  clusterSelector:
    matchLabels:
      cluster-type: edge
      industry: manufacturing

Fleet Offline Resilience

Fleet agents periodically pull updates from Git, so when an edge cluster temporarily loses connectivity, updates are automatically applied upon reconnection.

For fully air-gapped environments, you can host a portable Git repository or OCI registry mirror on a USB drive or laptop, and Fleet syncs from this local source.

Label-Based Targeting

Apply consistent labels to edge clusters for precise deployment targeting without hardcoding cluster names:

yaml
# Example cluster labels
labels:
  cluster-type: edge
  region: store-42
  hardware: rpi5
  network: limited

Edge Operations Best Practices

Resource Management

Edge devices cannot tolerate runaway resource consumption. Best practices from Reintech's tutorial:

yaml
# Enforce resource limits on all containers
apiVersion: v1
kind: LimitRange
metadata:
  name: edge-limits
  namespace: default
spec:
  limits:
  - default:
      cpu: "200m"
      memory: "256Mi"
    defaultRequest:
      cpu: "100m"
      memory: "128Mi"
    type: Container

Network Resilience

  • Buffer metrics and logs locally and batch-send when connectivity recovers
  • Use Prometheus local storage for temporary metric retention
  • Use Grafana Agent remote-write for central metric aggregation

Security

  • Enable disk encryption (LUKS) since physical access to devices is possible
  • Activate K3s secrets encryption
  • Apply network policies to minimize pod-to-pod communication
  • Automate regular security update application

Lightweight Monitoring

yaml
# Lightweight monitoring stack for edge
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-exporter
spec:
  selector:
    matchLabels:
      app: node-exporter
  template:
    spec:
      containers:
      - name: node-exporter
        image: prom/node-exporter:latest
        resources:
          requests:
            cpu: "50m"
            memory: "32Mi"
          limits:
            cpu: "100m"
            memory: "64Mi"

Industry Use Cases

Smart Retail

Deploy Raspberry Pi + K3s in each store for inventory management AI, digital signage, and POS integration. CloudOptimo's case study highlights lightweight AI inference model deployment at the edge.

Manufacturing (Smart Factory)

Place K3s agents on each production line for quality inspection AI, predictive maintenance, and sensor data collection. Manage all locations centrally with Fleet updates from a management cluster.

Smart Agriculture

Run K3s on field sensor gateways to collect and pre-process soil and weather data at the edge. 2026 trends highlight Raspberry Pi clusters powering smart agriculture applications.

Telecommunications Infrastructure

Deploy K3s at 5G base stations for MEC (Multi-access Edge Computing) workloads, executing latency-sensitive processing at the network edge.

Conclusion: Your Edge Kubernetes Partner

K3s is the most practical solution for deploying Kubernetes to edge and IoT environments:

  • Under 70MB binary runs on everything from Raspberry Pi to industrial PCs
  • Full ARM64/ARMv7 support covers the broadest range of devices
  • Air-gapped installation handles offline environments
  • Rancher Fleet manages hundreds of clusters via GitOps

Kubo provides centralized edge K3s cluster management from ¥48,000/month. Combined with Captain.AI, edge AI workload management becomes automated.

For edge Kubernetes deployment and operations consulting, contact us.

← Back to all posts