Self-Hosted GitOps Pipeline: Gitea + ArgoCD Guide

Build a Self-Hosted GitOps Pipeline with Gitea, ArgoCD, and Kubernetes at Home - Photo by Rahul Mishra on Unsplash

The error message was maddening: “Permission denied while cloning repository.” It was my repository. On my server. In my basement. I own everything here, including the questionable Wi-Fi router and the cat that keeps unplugging cables. Yet somehow, my GitOps pipeline decided to stage a mutiny. If you’ve ever felt personally attacked by your own self-hosted CI/CD setup, you’re not alone.

This article is here to save your sanity (and maybe your cat’s life). We’re diving deep into building a self-hosted GitOps pipeline using Gitea, ArgoCD, and Kubernetes on your home lab. Whether you’re a homelab enthusiast or a DevOps engineer tired of fighting with cloud services, this guide will help you take back control. No more cryptic errors, no more dependency nightmares—just a clean, reliable pipeline that works exactly how you want it to. Let’s roll up our sleeves and fix this mess.


What is GitOps and Why Self-Host?

GitOps is a game-changer for managing infrastructure and application deployments. At its core, GitOps means using Git as the single source of truth for your system’s desired state. Instead of manually tweaking configurations or relying on someone’s “I swear this works” bash script, GitOps lets you define everything declaratively in Git repositories. Kubernetes then syncs your cluster to match the state defined in Git. It’s automated, repeatable, and—when done right—beautifully simple.

But why self-host your CI/CD pipeline? For homelab enthusiasts, self-hosting is the ultimate flex. It’s like growing your own vegetables instead of buying them at the store. You get full control, no vendor lock-in, and the satisfaction of knowing you’re running everything on your own hardware. For DevOps engineers, self-hosting means tailoring the pipeline to your exact needs, ensuring workflows are as efficient—or chaotic—as you want them to be.

💡 Pro Tip: Start small with a single project before going full GitOps on your entire homelab. Debugging a broken pipeline at 2 AM is not fun.

Key Tools for Your Pipeline

  • Gitea: A lightweight, self-hosted Git service. Think of it as GitHub’s chill cousin who doesn’t charge you for private repos.
  • ArgoCD: The GitOps powerhouse that syncs your Git repositories with your Kubernetes clusters. It’s like having a personal assistant for your deployments.
  • Kubernetes: The container orchestration king. If you’re not using Kubernetes yet, prepare for a rabbit hole of YAML files and endless possibilities.
🔐 Security Note: Self-hosting means you’re responsible for securing your pipeline. Always use HTTPS, configure firewalls, and limit access to your repositories.

Step 1: Setting Up Your Home Kubernetes Cluster

Setting up a Kubernetes cluster at home is both thrilling and maddening. Think of it like assembling IKEA furniture, but instead of a bookshelf, you’re building a self-hosted CI/CD powerhouse. Let’s break it down.

Hardware Requirements

You don’t need a data center in your basement (though if you have one, I’m jealous). A few low-power devices like Raspberry Pis or Intel NUCs will do the trick. Here’s what you’ll need:

  • Raspberry Pi: Affordable and power-efficient. Go for the 4GB or 8GB models.
  • Intel NUC: More powerful than a Pi, great for running heavier workloads like Gitea or ArgoCD.
  • Storage: Use SSDs for speed. Slow storage will bottleneck your CI/CD jobs.
  • Networking: A decent router or switch is essential. VLAN support is a bonus for network segmentation.
💡 Pro Tip: If you’re using Raspberry Pis, invest in a reliable USB-C power supply. Flaky power leads to flaky clusters.

Installing Kubernetes with k3s

For simplicity, we’ll use k3s, a lightweight Kubernetes distribution perfect for home labs. Here’s how to get started:


# Download the k3s installation script
curl -sfL https://get.k3s.io -o install-k3s.sh

# Verify the script's integrity (check the official k3s site for checksum details)
sha256sum install-k3s.sh

# Run the script manually after verification
sudo sh install-k3s.sh

# Check if k3s is running
sudo kubectl get nodes

# Join worker nodes to the cluster
curl -sfL https://get.k3s.io -o install-k3s-worker.sh
sha256sum install-k3s-worker.sh
sudo sh install-k3s-worker.sh K3S_URL=https://<MASTER_IP>:6443 K3S_TOKEN=<TOKEN>

Replace <MASTER_IP> and <TOKEN> with the actual values from your master node. The token can be found in /var/lib/rancher/k3s/server/node-token on the master.

📚 Continue Reading

Sign in with your Google or Facebook account to read the full article.
It takes just 2 seconds!

Already have an account? Log in here

Comments

Leave a Reply

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