How this-is-tobi/homelab works
Project Type and Purpose
• This is an infrastructure‐as‐code and GitOps homelab project. It uses Ansible to bootstrap and configure a two‐tier environment:
• “Infra” layer: a gateway node (running HAProxy, Pi-Hole, WireGuard) plus a K3s cluster (masters & workers).
• “Kube” layer: Kubernetes services and applications deployed via Ansible and managed over GitOps (Argo CD + Helm charts).
• Purpose: rapid stand‐up of a homelab for testing CI/CD, monitoring, security, etc.
File Structure Analysis
• Top‐level:
• ansible/infra: playbooks, roles, inventory for provisioning VMs/hosts.
• ansible/kube: playbooks, roles, inventory for deploying to the K3s cluster.
• argo-cd directory: Helm apps definitions for GitOps (Chart.yaml, values, templates).
• docs, scripts, run.sh: documentation and helper scripts.
• Patterns & Config files:
• Ansible roles follow a clear separation: common, gateway, k3s.
• Kubernetes services organized into “core”, “additional”, “utils” roles.
• Argo CD manifests group each service as a Helm app under argo-cd/apps.
README Insights
• Confirms two installation stages: “Infra” via ansible/infra/install.yml, then “Kubernetes” via ansible/kube/install.yml.
• Encourages use of run.sh wrapper to invoke Ansible with inventories.
• Services include monitoring (Prometheus/Grafana), CI runners, registries, identity (Keycloak, Vault), storage (MinIO, Longhorn), etc.
a. Main Components
• Ansible Control Host (your laptop/CI)
• Gateway Host (bare metal/VM)
• K3s Master Nodes (HA API, scheduling)
• K3s Worker Nodes (app execution)
• Argo CD (GitOps control plane)
• Core Services (Cert-Manager, Traefik, SSO, Vault)
• Additional Services (Harbor, Gitea, SonarQube, etc.)
• Monitoring Stack (Prometheus, Grafana, Loki)
• External Services/Users (Internet DNS, VPN clients)
b. Relationships & Data Flows
1. Ansible → Gateway + K3s nodes: SSH to provision OS, Docker, WireGuard, K3s.
2. Gateway → Internet: DNS resolution (Pi-Hole), load balancing (HAProxy), VPN ingress/egress (WireGuard).
3. K3s Masters ←→ Workers: Kubernetes control‐plane communication.
4. Ansible-Kube → K3s API: deploy core & additional Helm charts.
5. Argo CD monitors Git repo (argo-cd/apps & envs) → pushes manifests to K3s API.
6. Users/CI → WireGuard VPN → internal services; external web clients → HAProxy → Traefik ingress.
c. Architectural Patterns
• IaC with Ansible roles & inventories
• Microservices on Kubernetes
• GitOps via Argo CD + Helm charts
• Layered network: gateway perimeter → internal cluster
• Role separation: core infra vs. dev/test services
d. Technologies & Frameworks
• Ansible (roles, playbooks, inventories)
• K3s (lightweight Kubernetes)
• Docker (gateway containers)
• Helm & Argo CD (GitOps)
• WireGuard, HAProxy, Pi-Hole (network gateway)
• Cert-Manager, Traefik, Vault, Keycloak, MinIO, etc.