惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
A
About on SuperTechFans
H
Help Net Security
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
C
Check Point Blog
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
Last Week in AI
Last Week in AI
D
Docker
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
Jina AI
Jina AI
F
Fortinet All Blogs
宝玉的分享
宝玉的分享
小众软件
小众软件
有赞技术团队
有赞技术团队
F
Full Disclosure
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Recorded Future
Recorded Future
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
量子位
U
Unit 42
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
O
OpenAI News
S
Secure Thoughts
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Google Online Security Blog
Google Online Security Blog
Cloudbric
Cloudbric
W
WeLiveSecurity
IT之家
IT之家

TerminalBytes

Best Frigate NVR hardware in 2026 (post-Coral edition) | TerminalBytes Reverse Engineering the iPod Classic Sanctuary: the browser-based Kindle jailbreak | TerminalBytes Steam Machine alternatives: mini PCs that game for less | TerminalBytes Oracle Cloud free tier 2026: 4 OCPU/24GB cut to 2 OCPU/12GB | TerminalBytes Run Gemma 4 on a mini PC, no GPU required My Arduino spins faster when Claude burns more tokens Kindle dashboard: 3 ways to build one in 2026 Best mini PC for local LLMs in 2026 (Strix Halo era) You Don't Need a Mac Mini to Run OpenClaw The Self-Hosting Revolution Powered by Mini PCs SoundLeaf: Beautiful iOS Client App for Audiobookshelf My iPhone 8 Refuses to Die: Now It's a Solar-Powered Vision OCR Server Homelab: Hosting multiple Game Servers on a Single Mini PC Reviving an Old Kindle Paperwhite 7th Gen The Ultimate Guide to Running a Minecraft Server on a Mini PC Best Mini PCs for Home Lab 2025: NUC vs Beelink vs ThinkCentre Setting Up a Robust PostgreSQL High-Availability Cluster on Azure How to Create Your Own Free VPN Server Using Oracle Cloud (2025 Guide) Set Up a Free Minecraft PE Server Using Oracle Cloud in 2025 Prompt Engineering for ChatGPT and GPT-4 (Practical Guide) Create Your Own Minecraft PE Server for Free Scalable Node.js Backend Without Express, Koa, or Hapi How to Use GeForce Now in India (VPN and Cloud Workarounds) Azure AD as an Identity Provider for AWS Cognito Free WordPress Blog with Custom Domain on Google Cloud sshuttle - A Free VPN Over SSH for Cheap, Private Browsing Raspberry Pi Temperature and Humidity Monitor with Grafana Raspberry Pi Setup Without a Monitor, Keyboard, or Mouse 6 Common Linux Commands for System Monitoring Basic Linux Commands for File Manipulation and Compression Basic Linux Commands For Text Manipulation Top 10 Linux Commands Of All Time
Kubernetes at Home - From Docker Compose to K3s
Hemant Kumar · 2025-01-27 · via TerminalBytes
On this page

Kubernetes at Home - From Docker Compose to K3s

Are you running a bunch of containers with Docker Compose at home and feeling like you’ve outgrown it? Maybe you’re curious about Kubernetes but worried it might be overkill for your home setup? Well, you’re in for a treat! Today, we’re going to explore how to level up your home lab by migrating from Docker Compose to K3s, a lightweight Kubernetes distribution that’s perfect for home environments.

Comparison of Docker Compose and K3s features

Understanding the Shift: Why Move to K3s?

If Docker Compose has been your trusty companion for running containers at home, you might wonder why you should even consider switching to K3s. While Docker Compose is fantastic for simple container orchestration, it has limitations that become apparent as your home lab grows:

  • Limited scaling capabilities: Docker Compose works well for single-host deployments but becomes unwieldy when you want to spread your services across multiple machines.
  • Basic service discovery: While functional, the service discovery in Docker Compose isn’t as robust as what Kubernetes offers.
  • Restricted orchestration features: You miss out on advanced features like rolling updates, automated rollbacks, and sophisticated health checks.

Enter K3s, a certified Kubernetes distribution designed specifically for resource-constrained environments. It offers:

  • Lightweight footprint: Requires only 512MB of RAM to run
  • Simple installation: Single binary installation process
  • Full Kubernetes compatibility: Access to the entire Kubernetes ecosystem
  • Perfect for home labs: Optimized for ARM64 and ARMv7 devices (hello, Raspberry Pi!)

Prerequisites for Migration

Before we dive into the migration process, let’s make sure you have everything you need:

System Requirements

  • A Linux system with at least:
    • 1 CPU core (2+ recommended)
    • 512MB RAM (1GB+ recommended)
    • 1GB storage space
  • Docker installed (for running existing containers)
  • curl or wget for downloading K3s
  • Basic familiarity with YAML and command-line operations
  • kubectl: The Kubernetes command-line tool
  • k9s (optional): A terminal-based UI for managing Kubernetes clusters
  • Lens (optional): A powerful Kubernetes IDE

Preparing Your Environment

Let’s start by setting up K3s and preparing for the migration.

K3s architecture in a home lab setup

Installing K3s

# Download and install K3s
curl -sfL https://get.k3s.io | sh -

# Wait for the service to start
sudo systemctl status k3s

# Set up kubectl configuration
mkdir ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $USER:$USER ~/.kube/config

Backing Up Docker Compose Configuration

Before making any changes, let’s back up your existing Docker Compose setup:

# Create a backup directory
mkdir ~/docker-backup
# Copy your docker-compose files
cp docker-compose.yml ~/docker-backup/
# Export any volumes if needed
docker run --rm -v [volume-name]:/volume -v ~/docker-backup:/backup alpine tar -czf /backup/volume-backup.tar.gz /volume

Migration Steps from Docker Compose to K3s

1. Converting Docker Compose to Kubernetes Manifests

You have two approaches:

Using Kompose (Automated Conversion)

Kompose is a conversion tool that can automatically transform Docker Compose files to Kubernetes manifests:

# Install Kompose
curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.1/kompose-linux-amd64 -o kompose
chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose

# Convert your docker-compose.yml
kompose convert -f docker-compose.yml

Here’s an example of converting a simple web application:

Docker Compose:

version: '3'
services:
  webapp:
    image: nginx
    ports:
      - "80:80"
    volumes:
      - ./html:/usr/share/nginx/html

Kubernetes Deployment and Service:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webapp
  template:
    metadata:
      labels:
        app: webapp
    spec:
      containers:
      - name: webapp
        image: nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: webapp
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
  selector:
    app: webapp

2. Deploying to K3s

Apply your new Kubernetes manifests:

kubectl apply -f webapp-deployment.yaml
kubectl apply -f webapp-service.yaml

# Verify deployment
kubectl get pods
kubectl get services

Best Practices for K3s in Home Labs

Resource Management

  • Use resource limits in your deployments to prevent any single service from consuming too many resources:
resources:
  limits:
    memory: "128Mi"
    cpu: "500m"

Storage Configuration

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml

Monitoring

Set up basic monitoring with Prometheus and Grafana:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus prometheus-community/kube-prometheus-stack

Here’s a practical example of migrating a Plex media server from Docker Compose to K3s:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: plex
spec:
  replicas: 1
  selector:
    matchLabels:
      app: plex
  template:
    metadata:
      labels:
        app: plex
    spec:
      containers:
      - name: plex
        image: plexinc/pms-docker
        ports:
        - containerPort: 32400
        volumeMounts:
        - name: media
          mountPath: /data
      volumes:
      - name: media
        hostPath:
          path: /mnt/media
---
apiVersion: v1
kind: Service
metadata:
  name: plex
spec:
  type: NodePort
  ports:
  - port: 32400
    targetPort: 32400
    nodePort: 32400
  selector:
    app: plex

Conclusion: Embracing the Future

Transitioning from Docker Compose to K3s might seem daunting at first, but the benefits are worth it. You’ll gain access to powerful Kubernetes features while maintaining a lightweight footprint suitable for home use. The migration process also provides an excellent opportunity to learn Kubernetes concepts hands-on.

Useful Resources for Further Learning

Remember, the key to a successful migration is taking it one service at a time. Start with non-critical services, learn from any mistakes, and gradually move your entire stack to K3s. Happy clustering! 🚀