The name comes from a silly portmanteau between kube and m1k (my nickname)
This repository contains the OpenTofu code and Argo CD applications for deploying and managing a homelab k8s infrastructure.
kub1k is a K3s cluster on Flatcar Container Linux, running as VMs on Synology Virtual Machine Manager. The number of control plane nodes (embedded etcd) and dedicated workers is set by control_count and worker_count, and label_controls_as_worker lets the control plane nodes run workloads too. OpenTofu provisions the VMs, installs K3s and bootstraps Calico, CoreDNS, kube-vip and Argo CD. From there an Argo CD app of apps deploys everything else.
The following components are part of this setup:
terraform/: node VMs, the GitHub Actions runner VM, the K3s install, the bootstrap components and Keycloak SSOapps/: the Argo CD app of apps, oneApplicationper componentcharts/: local Helm charts used by those applicationstools/: helper scripts and the K3s version upgrader
- OpenTofu
- make, curl and jq
- Go, for
make upgrade-kubernetes-version - An OpenBao token in
VAULT_ADDRandVAULT_TOKEN - Credentials for the S3 state backend in
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY
- Clone this repository and change into it.
- Review the variables in
terraform/variables.tf,terraform/vm_variables.tfandterraform/runner_variables.tf. - Run
make init. It fetches the kubeconfig from OpenBao and initializes the backend. - Run
make planto see the execution plan. - Run
make applyto apply it.
Run make help for the other targets.
- Pull requests touching
terraform/get a plan comment, and merging applies that plan. Both run on the self-hosted runner VM. - argocd-apps-action opens pull requests for new chart versions of the Argo CD applications.
- Dependabot opens pull requests for major workflow action bumps and for OpenTofu provider bumps.
This project is licensed under the MIT License.
The cluster runs on:
The grafana dashboards are based on the followings projects:
