Skip to content

Wife approved HomeOps driven by Kubernetes and GitOps using Flux

License

Notifications You must be signed in to change notification settings

martinohmann/home-ops

Repository files navigation

Kubernetes at Home

... managed with Terraform, Ansible, Flux, Renovate, and GitHub Actions

Kubernetes  Flux  Renovate 

Age-Days  Uptime-Days  Node-Count  Pod-Count  CPU-Usage  Memory-Usage 


📖 Overview

This is a mono repository for my home infrastructure and Kubernetes cluster. I try to adhere to Infrastructure as Code (IaC) and GitOps practices using tools like Ansible, Terraform, Kubernetes, Flux, Renovate, and GitHub Actions.


⛵ Kubernetes

There is a template over at onedr0p/flux-cluster-template if you want to try and follow along with some of the practices I use here.

Installation

My cluster is k3s provisioned over Proxmox Ubuntu VMs using the Ansible galaxy role ansible-role-k3s. The VMs are managed via Terraform.

This is a semi-hyper-converged cluster, workloads and block storage are sharing the same available resources on my nodes while I have a separate server for NFS shares, bulk file storage and backups.

Core Components

  • actions-runner-controller: self-hosted Github runners
  • cilium: internal Kubernetes networking plugin
  • cert-manager: creates SSL certificates for services in my cluster
  • external-dns: automatically syncs DNS records from my cluster ingresses to a DNS provider
  • ingress-nginx: ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer
  • longhorn: distributed block storage for persistent storage
  • sops: managed secrets for Kubernetes, Ansible, and Terraform which are committed to Git
  • system-upgrade-controller: automate K3s server and agent updates
  • volsync: backup and recovery of persistent volume claims

GitOps

Flux watches the clusters in my kubernetes folder (see Directories below) and makes the changes to my clusters based on the state of my Git repository.

The way Flux works for me here is it will recursively search the kubernetes/${cluster}/apps folder until it finds the most top level kustomization.yaml per directory and then apply all the resources listed in it. That aforementioned kustomization.yaml will generally only have a namespace resource and one or many Flux kustomizations (ks.yaml). Under the control of those Flux kustomizations there will be a HelmRelease or other resources related to the application which will be applied.

Renovate watches my entire repository looking for dependency updates, when they are found a PR is automatically created. When some PRs are merged Flux applies the changes to my cluster.

Directories

This Git repository contains the following directories under Kubernetes.

📁 kubernetes
├── 📁 main            # main cluster
│   ├── 📁 apps           # applications
│   ├── 📁 bootstrap      # bootstrap procedures
│   ├── 📁 flux           # core flux configuration
│   └── 📁 templates      # re-useable components
└── 📁 storage         # storage cluster
    ├── 📁 apps           # applications
    ├── 📁 bootstrap      # bootstrap procedures
    └── 📁 flux           # core flux configuration

🔧 Hardware

Click to see the rack! rack
Device Count Disk Size Ram Operating System Purpose
ThinkCentre M900 Tiny i5-6500T 2 1TB NVMe 32GB Proxmox VE 8 Kubernetes VMs
ThinkCentre M900 Tiny i7-6700T 1 1TB NVMe 32GB Proxmox VE 8 Kubernetes VMs + UniFi Controller
STRHIGP Mini J4125 1 128GB SSD 8GB OPNsense Router
Topton N5105 DIY NAS 1 240GB SSD + 2x 6TB HDD ZFS (mirrored vdevs) 32GB Debian 12 NFS + Backup Server
PiKVM (Raspberry Pi 4) 1 16GB (SD) 4GB PiKVM (Arch) KVM
UniFi USW-24-PoE 1 - - - Core Switch

🤝 Gratitude and Thanks

Thanks to all the people who donate their time to the Home Operations Discord community. Be sure to check out kubesearch.dev for ideas on how to deploy applications or get ideas on what you may deploy.


📜 Changelog

See my awful commit history


📜 License

See LICENSE