Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Wife tolerated HomeOps driven by Kubernetes, and Gitops via Flux.

License

Notifications You must be signed in to change notification settings

joryirving/home-ops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

My Homelab Repository ❄️

... automated via Flux, Renovate and GitHub Actions πŸ€–

DiscordΒ Β  TalosΒ Β  KubernetesΒ Β  Renovate

Home-InternetΒ Β  Status-PageΒ Β  Plex

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


Overview

This is a monorepository is for my home kubernetes clusters. I try to adhere to Infrastructure as Code (IaC) and GitOps practices using tools like Terraform, Kubernetes, Flux, Renovate, and GitHub Actions.

The purpose here is to learn k8s, while practicing Gitops.


β›΅ Kubernetes

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

Installation

My clusters run talos linux immutable kubernetes OS. 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 NAS server running Unraid withg NFS/SMB 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
  • external-secrets: managed Kubernetes secrets using 1Password.
  • ingress-nginx: ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer
  • longhorn: Cloud native distributed block storage for Kubernetes
  • rook-ceph: Cloud native distributed block storage for Kubernetes
  • sops: managed secrets for Kubernetes, Ansible, and Terraform which are committed to Git
  • spegel: stateless cluster local OCI registry mirror
  • tf-controller: additional Flux component used to run Terraform from within a Kubernetes cluster.
  • 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. Those Flux kustomizations will generally have a HelmRelease or other resources related to the application underneath it 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
β”‚   └── πŸ“ talos       # talos configuration
β”œβ”€β”€ πŸ“ shared          # shared cluster resources
└── πŸ“ utility         # utility cluster
    β”œβ”€β”€ πŸ“ apps        # applications
    β”œβ”€β”€ πŸ“ bootstrap   # bootstrap procedures
    β”œβ”€β”€ πŸ“ flux        # core flux configuration
    └── πŸ“ talos       # talos configuration

Networking

Click to see a high-level network diagram dns

☁️ Cloud Dependencies

While most of my infrastructure and workloads are self-hosted I do rely upon the cloud for certain key parts of my setup. This saves me from having to worry about two things. (1) Dealing with chicken/egg scenarios and (2) services I critically need whether my cluster is online or not.

The alternative solution to these two problems would be to host a Kubernetes cluster in the cloud and deploy applications like HCVault, Vaultwarden, ntfy, and Gatus. However, maintaining another cluster and monitoring another group of workloads is a lot more time and effort than I am willing to put in.

Service Use Cost
1Password Secrets with External Secrets Free - Work
Cloudflare Domain and R2 ~$30/yr
GitHub Hosting this repository and continuous integration/deployments Free
Healthchecks.io Monitoring internet connectivity and external facing applications Free
Total: ~$3/mo

🌐 DNS

Home DNS

In my cluster external-dns is deployed with the RFC2136 provider which syncs DNS records to unifi via external-dns-unifi-webhook.

Public DNS

Outside the external-dns instance mentioned above another instance is deployed in my cluster and configured to sync DNS records to Cloudflare. The only ingress this external-dns instance looks at to gather DNS records to put in Cloudflare are ones that have an ingress class name of external and contain an ingress annotation external-dns.alpha.kubernetes.io/target.


πŸ”§ Hardware

Main Kubernetes Cluster

Name Device CPU OS Disk Data Disk RAM OS Purpose
Ayaka Dell 7080mff i5-10500T 480GB SSD 1TB NVME 64GB Talos k8s control-plane
Eula Dell 7080mff i7-10700T 480GB SSD 1TB NVME 64GB Talos k8s control-plane
Ganyu Dell 3080mff i5-10500T 500GB SSD 1TB NVME 64GB Talos k8s control-plane
HuTao Dell 3080mff i5-10500T 480GB SSD 1TB NVME 64GB Talos k8s worker
Navia Dell 3080mff i5-10500T 240GB SSD 1TB NVME 64GB Talos k8s worker
Yelan Dell 3080mff i5-10500T 240GB SSD 1TB NVME 64GB Talos k8s worker

Total CPU: 76 threads Total RAM: 384GB

Utility Kubernetes Cluster

Name Device CPU OS Disk Data Disk RAM OS Purpose
Celestia Bosgame P1 Ryzen 7 5700U 480GB SSD 1TB NVME 32GB Talos k8s control-plane

Total CPU: 16 threads Total RAM: 32GB

Supporting Hardware

Name Device CPU OS Disk Data Disk RAM OS Purpose
NAS HP z820 E5-2680v2 32GB USB 500GB NVMe 128GB Unraid NAS/NFS/Backup
DAS Lenovo SA120 - - 56TB - - ZFS - Raidz2
PiKVM Raspberry Pi4 Cortex A72 64GB mSD - 4GB PiKVM (Arch) KVM

Networking/UPS Hardware

Device Purpose
Unifi UDM-SE Network - Router
USW-Pro-24-POE Network - Switch
Back-UPS 600 Network - UPS
Unifi USW-Enterprise-24-PoE Server - Switch
Tripp Lite 1500 Server - UPS

⭐ Stargazers

Star History Chart


🀝 Thanks

Big shout out to original cluster-template, and 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