Skip to content

dmfrey/home-gitops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16,449 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ My Home GitOps Repository 🚧

... managed with Flux, Renovate, and GitHub Actions πŸ€–

DiscordΒ Β  TalosΒ Β  KubernetesΒ Β  FluxΒ Β  Renovate

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


πŸ’‘ 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 Terraform, Kubernetes, Flux, Renovate, and GitHub Actions.

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


β›΅ Kubernetes

My Kubernetes cluster is deployed with Talos. 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 a separate NAS for NFS/SMB shares, bulk file storage and backups.

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.

Core Components

  • Networking & Service Mesh: cilium provides eBPF-based networking, while envoy powers service-to-service communication with L7 proxying and traffic management. cloudflared secures ingress traffic via Cloudflare, and external-dns keeps DNS records in sync automatically.
  • Security & Secrets: cert-manager automates SSL/TLS certificate management. For secrets, I use external-secrets with 1Password Connect to inject secrets into Kubernetes, and sops to store and manage encrypted secrets in Git.
  • Storage & Data Protection: rook provides distributed storage for persistent volumes, with volsync handling backups and restores. spegel improves reliability by running a stateless, cluster-local OCI image mirror.
  • Automation & CI/CD: actions-runner-controller runs self-hosted GitHub Actions runners directly in the cluster for continuous integration workflows. For IaC, I use tofu-controller as additional Flux component used to run Terraform from within a Kubernetes cluster.

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/home-k8s-001
β”œβ”€β”€ πŸ“ apps       # applications
β”œβ”€β”€ πŸ“ components # re-useable kustomize components
└── πŸ“ flux       # flux system configuration

Flux Workflow

This is a high-level look how Flux deploys my applications with dependencies. In most cases a HelmRelease will depend on other HelmRelease's, in other cases a Kustomization will depend on other Kustomization's, and in rare situations an app can depend on a HelmRelease and a Kustomization. The example below shows that home-assistant won't be deployed or upgrade until the rook-ceph-cluster Helm release is installed or in a healthy state.

graph TD
    A>Kustomization: rook-ceph] -->|Creates| B[HelmRelease: rook-ceph]
    A>Kustomization: rook-ceph] -->|Creates| C[HelmRelease: rook-ceph-cluster]
    C>HelmRelease: rook-ceph-cluster] -->|Depends on| B>HelmRelease: rook-ceph]
    D>Kustomization: home-assistant] -->|Creates| E(HelmRelease: home-assistant)
    E>HelmRelease: home-assistant] -->|Depends on| C>HelmRelease: rook-ceph-cluster]
Loading

🌎 DNS

In my cluster there are two instances of ExternalDNS running. One for syncing private DNS records to my UDM Pro Max using ExternalDNS webhook provider for UniFi, while another instance syncs public DNS to Cloudflare. This setup is managed by creating ingresses with two specific classes: internal for private DNS and external for public DNS. The external-dns instances then syncs the DNS records to their respective platforms accordingly.


βš™ Hardware

My cluster runs on a variety of energy-efficient hardware.

πŸ’» Compute & Storage

Device Manufacturer Model CPU RAM Role
k8s-0 GEEKOM Mini IT13 Intel 13th Gen 64 GB Kubernetes Control Plane & Worker
k8s-1 GEEKOM Mini IT13 Intel 13th Gen 64 GB Kubernetes Control Plane & Worker
k8s-2 GEEKOM Mini IT13 Intel 13th Gen 64 GB Kubernetes Control Plane & Worker
NAS QNAP TS-462 - - Network Attached Storage

Each Kubernetes node has the following disk layout:

  • System: 1x Samsung 870 EVO 1 TB SATA SSD
  • Ceph: 1x Silicon Power US75 2 TB NVMe SSD
  • OpenEBS: 1x KingSpec NT Series 128GB M.2 2242 SATA SSD
  • TPU: 1x Coral M.2 Accelerator with Dual Edge TPU

🌐 Network & Power

Device Manufacturer Model Role
Unifi Cable Internet Ubiquiti UCI Modem
Dream Machine SE Ubiquiti UDM SE Core Router & Firewall
Switch Pro Max 24 Ubiquiti USW Pro Max 24 Core Switch
Switch Ultra 8 Ubiquiti USW Ultra 8 Port Distribution Switch
Switch Flex Ubiquiti USW Flex Outdoor Switch
Power Distribution Pro Ubiquiti UPS PDU Pro Power Distribution
Rackmount UPS Ubiquiti UPS 2U Uninterruptible Power Supply
Redundant Power System Ubiquiti USP RPS Redundant Power Supply
Cluster UPS Ubiquiti UPS Tower Uninterruptible Power Supply

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •