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, Terraform, Kubernetes, Flux, Renovate and GitHub Actions.
There's an excellent template over at k8s-at-home/template-cluster-k3s if you wanted to try and follow along with some of the practices I use here.
My cluster is k3s provisioned overtop bare-metal Ubuntu 20.04 using the Ansible galaxy role ansible-role-k3s. 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) file storage. I also use my Synology NAS with the Synology CSI, which provisions iSCSI Volumes to some of my deployments.
🔸 Click here to see my Ansible playbooks and roles.
- mozilla/sops: Manages secrets for Kubernetes
- kubernetes/ingress-nginx: Ingress controller to expose HTTP traffic to pods over DNS.
- jetstack/cert-manager: Creates SSL certificates for services in my Kubernetes cluster.
- cloudflare/cloudflared: Provides a secure network tunnel to expose some of my services to the internet.
- kubernetes-sigs/external-dns: Automatically manages DNS records from my cluster in a cloud DNS provider.
Flux watches my cluster folder (see Directories below) and makes the changes to my cluster based on the YAML manifests.
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.
The Git repository contains the following directories under cluster and are ordered below by how Flux will apply them.
- base: directory is the entrypoint to Flux.
- crds: directory contains custom resource definitions (CRDs) that need to exist globally in your cluster before anything else exists.
- core: directory (depends on crds) are important infrastructure applications (grouped by namespace) that should never be pruned by Flux.
- apps: directory (depends on core) is where your common applications (grouped by namespace) could be placed, Flux will prune resources here if they are not tracked by Git anymore.
Device | Hostname | Disk Size | Ram | Operating System | Purpose |
---|---|---|---|---|---|
Lenovo Thinkcentre M72e | dca-k3s-server-01 | 120GB | 8GB | Ubuntu Server 20.04.4 | Kubernetes Control Plane,etcd,worker |
Lenovo Thinkcentre M72e | dca-k3s-server-02 | 120GB | 8GB | Ubuntu Server 20.04.4 | Kubernetes Control Plane,etcd,worker |
Lenovo Thinkcentre M72e | dca-k3s-server-03 | 120GB | 8GB | Ubuntu Server 20.04.4 | Kubernetes Control Plane,etcd,worker |
Lenovo Thinkcentre M72e | dca-k3s-server-04 | 120GB | 8GB | Ubuntu Server 20.04.4 | Kubernetes Control Plane,etcd,worker |
Synology DS418 Play | dca-nas-server-01 | 32TB | 4GB | N/A | NAS |