Skip to content

A mono repository for my home infrastructure and Kubernetes cluster which adheres to Infrastructure as Code (IaC) and GitOps practices where possible

License

binaryn3xus/HomeOps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

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

Repository files navigation

My Home Operations Repository :octocat:

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

Kubernetes

Plex Home-Assistant


πŸ“– 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 the tools like Ansible, Kubernetes, Flux, Renovate and GitHub Actions.


β›΅ Kubernetes

Installation

My Kubernetes cluster is deploy 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 server with on my Synology NAS for storage for bulk file storage and backups.

Core Components

  • actions-runner-controller: Self-hosted Github runners.
  • cert-manager: Creates SSL certificates for services in my cluster.
  • cilium: Internal Kubernetes container networking interface.
  • cloudflared: Enables Cloudflare secure access to certain ingresses.
  • external-dns: Automatically syncs ingress DNS records to a DNS provider.
  • external-secrets: Managed Kubernetes secrets using Azure Keyvault.
  • ingress-nginx: Kubernetes ingress controller using NGINX as a reverse proxy and load balancer.
  • rook: Distributed block storage for peristent storage.
  • sops: Managed secrets for Kubernetes and Terraform which are commited to Git.
  • spegel: Stateless cluster local OCI registry mirror.
  • teleport: Manage some network resources remotely
  • 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 my kubernetes folder (see Directories below) and makes the changes to my cluster based on the YAML manifests.

The way Flux works for me here is it will recursively search the kubernetes/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      # Kubernetes cluster defined as code
β”œβ”€πŸ“ apps          # Apps deployed into my cluster grouped by namespace (see below)
β”œβ”€πŸ“ bootstrap     # Flux installation
β”œβ”€πŸ“ flux          # Main Flux configuration of repository
β””β”€πŸ“ templates      # re-useable components

πŸ“‘ Networking

Name CIDR
Server VLAN 10.0.30.0/24
Kubernetes pods 10.69.0.0/16
Kubernetes services 10.96.0.0/16

☁️ Cloud Dependencies

While most of my infrastructure and workloads are selfhosted 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.

Service Use Cost
GitHub Hosting this repository and continuous integration/deployments Free
Cloudflare Domain, DNS and proxy management Free
UptimeRobot Monitoring internet connectivity and external facing applications Free
NextDNS Pro DNS with some ad-blocking and other features ~$1.65.mo
Azure Key Vault Secrets with External Secrets ~$0.10/mo
Total: ~$1.75/mo

🌐 DNS

Home DNS

On my Vyos router I have Bind9 and dnsdist deployed as containers. In my cluster external-dns is deployed with the RFC2136 provider which syncs DNS records to bind9.

Downstream DNS servers configured in dnsdist such as bind9 (above) and NextDNS. All my clients use dnsdist as the upstream DNS server, this allows for more granularity with configuring DNS across my networks. These could be things like giving each of my VLANs a specific nextdns profile, or having all requests for my domain forward to bind9 on certain networks, or only using 1.1.1.1 instead of nextdns on certain networks where adblocking isn't required.

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

Model RAM OS Disk Size Data Disk Size Operating System Purpose Rack Location
HUNSN Micro Firewall Appliance 8 GB 64GB (SSD) VyOS Router 18U (Right)
Dell Optiplex 7050 Micro 16 GB 500GB (SSD) 1TB (NVMe) Talos Node 1 (K8s Control Plane) 15U (Left)
Dell Optiplex 7050 Micro 16 GB 500GB (SSD) 1TB (NVMe) Talos Node 2 (K8s Control Plane) 15U (Right)
Dell Optiplex 7050 Micro 16 GB 500GB (NVMe) 1TB (SSD) Talos Node 3 (K8s Worker) 16U (Left)
HP ProDesk 600 G3 Mini 16 GB 500GB (SSD) 1TB (NVMe) Talos Node 4 (K8s Worker) 17U (Right)
HP ProDesk 600 G3 Mini 16 GB 500GB (SSD) 1TB (NVMe) Talos Node 5 (K8s Control Plane) 17U (Left)
Dell Optiplex 3060 Micro 16 GB 500GB (SSD) 1TB (NVMe) Talos Node 6 (K8s Worker) 16U (Right)
Click to see the Full Home Ops Rack!

ServerRack

Rack U Hardware
Forbidden
Zone
PiKVM V4 Plus
22 16 Port KVM Switch
22 16 Port KVM Switch
21 24 Port Keystone Patch Panel
20 Unifi Standard 24 PoE (Gen1) Network Switch
19 Unifi CloudKey Gen 2
18 Linux Desktop - Intel Skull Canyon NUC
17 Kubernetes Node 4 - HP ProDesk 600 G3 Mini
Kubernetes Node 5 - HP ProDesk 600 G3 Mini
16 Kubernetes Node 3 - Dell Optiplex 7050 Micro
Kubernetes Node 6 - Dell Optiplex 3060 Micro
15 Kubernetes Node 1 - Dell Optiplex 7050 Micro
Kubernetes Node 2 - Dell Optiplex 7050 Micro
14 Synology DS1819+
13
12
11
10 Blank
9 VyOS Router - HUNSN Micro Firewall Appliance
8 Custom Build Server 1
Proxmox
7
6
5
4 Custom Build Server 2
3
2
1

🀝 Gratitude and Thanks

Big shout out to all the contributors to the flux-cluster-template projects that we are using in this repository.

Community member onedr0p for initially creating this amazing template and providing me with additional help.


πŸ“œ Changelog

See awful commit history


πŸ” License

See LICENSE