Skip to content

homelab k8s cluster deployed with Talos Linux; automated via Flux, Renovate, and GitHub Actions πŸ€–

License

Notifications You must be signed in to change notification settings

tslamars/k8s-gitops

Mars

πŸš€ My Home Operations Repository 🚧

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

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

Home-InternetΒ Β  Status-PageΒ Β 

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 Ansible, Terraform, Kubernetes, Flux, Renovate, and GitHub Actions.


🌱 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 server with ZFS 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

GitOps

Flux watches 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/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 monitors my entire repository for dependency updates, automatically creating a PR when updates are found. 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)
β”œβ”€πŸ“ components    # Re-usable kustomize components
β””β”€πŸ“ flux          # Flux system configuration

Cluster layout

This is a high-level look how Flux deploys my applications with dependencies. Below there are 3 Flux kustomizations postgres, postgres-cluster, and atuin. postgres is the first app that needs to be running and healthy before postgres-cluster and once postgres-cluster is healthy atuin will be deployed.

graph TD;
  id1>Kustomization: flux-system] -->|Creates| id2>Kustomization: cluster-apps];
  id2>Kustomization: cluster-apps] -->|Creates| id3>Kustomization: postgres];
  id2>Kustomization: cluster-apps] -->|Creates| id5>Kustomization: postgres-cluster]
  id2>Kustomization: cluster-apps] -->|Creates| id8>Kustomization: atuin]
  id3>Kustomization: postgres] -->|Creates| id4(HelmRelease: postgres);
  id5>Kustomization: postgres-cluster] -->|Depends on| id3>Kustomization: postgres];
  id5>Kustomization: postgres-cluster] -->|Creates| id10(Cluster: postgres);
  id8>Kustomization: atuin] -->|Creates| id9(HelmRelease: atuin);
  id8>Kustomization: atuin] -->|Depends on| id5>Kustomization: postgres-cluster];
Loading

🌎 DNS

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


Device Count OS Disk Size Data Disk Size Ram Operating System Purpose
MS-01 (i9-12900H) 3 1 TB M.2 1 TB M.2 64GB Talos Kubernetes
Dell R730XD 1 - Random drive sizes 128GB UnRAID OS NFS
UniFi UNAS Pro 1 - 7x16TB HDD 8GB UniFi OS NFS
UniFi UDM SE 1 - 1x3TB HDD - UniFi OS Router & NVR
UniFi USW Pro Max 24 PoE 1 - - - UniFi OS 2.5Gb PoE Switch
UniFi USW Pro Max 16 PoE 1 - - - UniFi OS 2.5Gb PoE Switch

πŸ™ Gratitude and Thanks

Many thanks to my friend @onedrop and all the fantastic 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 the latest release notes.


βš– License

See LICENSE.

About

homelab k8s cluster deployed with Talos Linux; automated via Flux, Renovate, and GitHub Actions πŸ€–

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •