Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Raspberry Pi

Raspberry Pi Kubernetes K3s: Lightweight Cluster Setup

Raspberry Pi Kubernetes K3s: Lightweight Cluster Setup

April 1, 2026 /Posted by / 0

Table of Contents

  1. What is K3s and Why Use It on Raspberry Pi
  2. Hardware Setup for a Pi Cluster
  3. Installing K3s on the Master Node
  4. Joining Worker Nodes to the Cluster
  5. Deploying Your First Application
  6. Monitoring with kubectl and Dashboard
  7. Persistent Storage and Networking
  8. Frequently Asked Questions

Kubernetes is the industry standard for container orchestration, and K3s makes it possible to run a fully functional cluster on Raspberry Pi hardware. Whether you are learning for career growth or building a production-grade home lab, a Pi-based K3s cluster is the most cost-effective way to master Kubernetes in India.

What is K3s and Why Use It on Raspberry Pi

K3s is a lightweight, certified Kubernetes distribution designed for resource-constrained environments. Created by Rancher Labs, it strips out cloud-provider-specific code and replaces etcd with SQLite, reducing the binary to under 100MB.

  • Memory footprint: ~512MB RAM for the server node (vs 2GB+ for full K8s)
  • Single binary: One ~60MB binary handles everything
  • ARM native: First-class ARM64 and ARMv7 support
  • Batteries included: Traefik ingress, CoreDNS, and Flannel CNI pre-configured
  • Production ready: CNCF certified Kubernetes conformant

Hardware Setup for a Pi Cluster

A minimal cluster needs at least 2 Pis; 3-4 is ideal for learning high availability:

Component Quantity Notes
Raspberry Pi 4/5 (4GB+) 3-4 8GB for server node recommended
MicroSD cards or NVMe SSDs 3-4 32GB+ each, SSD preferred
Ethernet cables 3-4 Gigabit for reliable networking
Network switch 1 Gigabit, 5+ ports
USB-C power supplies 3-4 5V 3A per Pi (or PoE HATs)
Cluster case/rack 1 Optional but keeps things tidy

Cluster Components on Zbotic.in

  • Waveshare Aluminium Alloy Case for Raspberry Pi 5
  • Waveshare Aluminum Heatsink For Raspberry Pi 5
  • Waveshare PCIe To Gigabit Ethernet And USB 3.2 Gen1 HAT For Raspberry Pi 5

Shop All Raspberry Pi Products

Installing K3s on the Master Node

Start with the server (master) node. Ensure each Pi has a unique hostname and static IP:

# Set hostname on the master node
sudo hostnamectl set-hostname k3s-master

# Assign a static IP (edit dhcpcd.conf or use NetworkManager)
# Example: 192.168.1.100 for master

# Enable cgroups (required for K3s)
# Edit /boot/firmware/cmdline.txt and add at the END of the line:
# cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
sudo nano /boot/firmware/cmdline.txt
sudo reboot

# Install K3s server
curl -sfL https://get.k3s.io | sh -

# Check the server status
sudo systemctl status k3s
sudo kubectl get nodes

# Get the node token (needed for workers)
sudo cat /var/lib/rancher/k3s/server/node-token

Joining Worker Nodes to the Cluster

# On each worker Pi, set a unique hostname:
sudo hostnamectl set-hostname k3s-worker-1  # or worker-2, worker-3

# Enable cgroups (same as master)
# Edit /boot/firmware/cmdline.txt, add:
# cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
sudo reboot

# Join the cluster (replace with your master IP and token)
curl -sfL https://get.k3s.io | K3S_URL=https://192.168.1.100:6443 
  K3S_TOKEN="your-node-token-here" sh -

# Back on the master, verify all nodes:
sudo kubectl get nodes
# NAME          STATUS   ROLES                  AGE   VERSION
# k3s-master    Ready    control-plane,master   10m   v1.30.x+k3s1
# k3s-worker-1  Ready    <none>                2m    v1.30.x+k3s1
# k3s-worker-2  Ready    <none>                1m    v1.30.x+k3s1

Deploying Your First Application

# Create a deployment YAML
cat << 'EOF' > nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:alpine
        ports:
        - containerPort: 80
        resources:
          limits:
            memory: "128Mi"
            cpu: "250m"
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  selector:
    app: nginx
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30080
EOF

# Deploy it
sudo kubectl apply -f nginx-deployment.yaml

# Check the deployment
sudo kubectl get pods -o wide
sudo kubectl get services

# Access at http://<any-node-ip>:30080

Recommended Product

3 in 1 Aluminum Heat Sink Set for Raspberry Pi 3/4

Buy on Zbotic.in

Monitoring with kubectl and Dashboard

# Install the Kubernetes Dashboard
GITHUB_URL=https://github.com/kubernetes/dashboard/releases
VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S 
  $GITHUB_URL/latest -o /dev/null | sed -e 's|.*/||')
sudo kubectl create -f 
  https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml

# Create admin user for dashboard
cat << 'EOF' | sudo kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
EOF

# Get the login token
sudo kubectl -n kubernetes-dashboard create token admin-user

# Access dashboard via port-forward
sudo kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443 --address=0.0.0.0

Persistent Storage and Networking

K3s includes local-path-provisioner for persistent volumes:

# Local path storage class is the default in K3s
sudo kubectl get storageclass
# NAME                   PROVISIONER             AGE
# local-path (default)   rancher.io/local-path   30m

# For NFS shared storage across nodes:
sudo apt install nfs-kernel-server  # On one Pi
sudo mkdir -p /srv/nfs/k3s
echo "/srv/nfs/k3s *(rw,sync,no_subtree_check)" | sudo tee -a /etc/exports
sudo exportfs -ra

# Useful networking commands
sudo kubectl get ingress
sudo kubectl get endpoints
sudo kubectl describe service nginx-service

Frequently Asked Questions

How many Raspberry Pis do I need for a K3s cluster?

Minimum 2 (1 server + 1 worker), but 3 is recommended. For high availability, use 3 server nodes with an embedded etcd cluster. A 4-node cluster (1 server + 3 workers) is ideal for learning.

Can I run K3s on Raspberry Pi 3?

Technically yes, but not recommended. The Pi 3 has only 1GB RAM, which barely covers K3s server requirements. Worker nodes on Pi 3 can run a few lightweight pods. Pi 4 with 4GB+ is the practical minimum.

What is the cost of building a Raspberry Pi Kubernetes cluster in India?

A 3-node cluster costs approximately ₹15,000-25,000 depending on Pi model and accessories. This includes 3x Pi 4 (4GB), cases, SD cards, ethernet cables, and a switch. Significantly cheaper than cloud Kubernetes.

K3s vs MicroK8s vs full Kubernetes for Raspberry Pi?

K3s is the best choice for Pi clusters due to lowest resource usage. MicroK8s works well for single-node setups. Full Kubernetes (kubeadm) requires 2GB+ RAM per node and is overkill for Pi.

Can I use WiFi instead of Ethernet for the cluster?

WiFi works but is unreliable for Kubernetes. Cluster communication is latency-sensitive, and WiFi adds jitter. Always use Ethernet for the cluster network. WiFi can be used for external access.

{“@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [{“@type”: “Question”, “name”: “How many Raspberry Pis do I need for a K3s cluster?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Minimum 2 (1 server + 1 worker), but 3 is recommended. For high availability, use 3 server nodes with an embedded etcd cluster. A 4-node cluster (1 server + 3 workers) is ideal for learning.”}}, {“@type”: “Question”, “name”: “Can I run K3s on Raspberry Pi 3?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Technically yes, but not recommended. The Pi 3 has only 1GB RAM, which barely covers K3s server requirements. Worker nodes on Pi 3 can run a few lightweight pods. Pi 4 with 4GB+ is the practical minimum.”}}, {“@type”: “Question”, “name”: “What is the cost of building a Raspberry Pi Kubernetes cluster in India?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “A 3-node cluster costs approximately u20b915,000-25,000 depending on Pi model and accessories. This includes 3x Pi 4 (4GB), cases, SD cards, ethernet cables, and a switch. Significantly cheaper than cloud Kubernetes.”}}, {“@type”: “Question”, “name”: “K3s vs MicroK8s vs full Kubernetes for Raspberry Pi?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “K3s is the best choice for Pi clusters due to lowest resource usage. MicroK8s works well for single-node setups. Full Kubernetes (kubeadm) requires 2GB+ RAM per node and is overkill for Pi.”}}, {“@type”: “Question”, “name”: “Can I use WiFi instead of Ethernet for the cluster?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “WiFi works but is unreliable for Kubernetes. Cluster communication is latency-sensitive, and WiFi adds jitter. Always use Ethernet for the cluster network. WiFi can be used for external access.”}}]}

Get All Your Raspberry Pi Components from Zbotic.in

India’s trusted store for genuine Raspberry Pi boards, HATs, accessories, and components. Fast shipping across India with expert support.

Shop Raspberry Pi Components

Tags: India, Pi, Raspberry, Raspberry Pi
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
ESP32 Baby Monitor: Audio and ...
blog esp32 baby monitor audio and temperature alert system 613436
blog wind direction vane digital compass and encoder 613440
Wind Direction Vane: Digital C...

Related posts

Svg%3E
Read more

Raspberry Pi Benchmarks: Performance Testing All Models

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi PoE: Power Over Ethernet Setup Guide

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi GSM HAT: SMS and Cellular IoT

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi RS485: Industrial Sensor Network

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi CAN Bus: Vehicle OBD2 Data Reader

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now