martinohmann / home-ops

Wife approved HomeOps driven by Kubernetes and GitOps using Flux
MIT License
5 stars 0 forks source link
flux home-ops kubernetes kubesearch
### Kubernetes at Home _... managed with Terraform, Ansible, Flux, Renovate, and GitHub Actions_
[![Kubernetes](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dkubernetes_version&style=for-the-badge&label=Kubernetes&logo=kubernetes&color=orange)](https://k3s.io/)  [![Flux](https://img.shields.io/badge/GitOps-Flux-blue?style=for-the-badge&logo=git)](https://fluxcd.io/)  [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?style=for-the-badge&logo=renovatebot)](https://github.com/renovatebot/renovate) 
[![Age-Days](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dcluster_age_days&style=flat-square&label=Age)](https://github.com/kashalls/kromgo/)  [![Uptime-Days](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dcluster_uptime_days&style=flat-square&label=Uptime)](https://github.com/kashalls/kromgo/)  [![Node-Count](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dcluster_node_count&style=flat-square&label=Nodes&color=blue)](https://github.com/kashalls/kromgo/)  [![Pod-Count](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dcluster_pod_count&style=flat-square&label=Pods&color=blue)](https://github.com/kashalls/kromgo/)  [![CPU-Usage](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dcluster_cpu_usage&style=flat-square&label=CPU)](https://github.com/kashalls/kromgo/)  [![Memory-Usage](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.18b.haus%2Fquery%3Fformat%3Dendpoint%26metric%3Dcluster_memory_usage&style=flat-square&label=Memory)](https://github.com/kashalls/kromgo/) 

šŸ“– 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

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 tiny 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