My home Kubernetes cluster managed with git-ops
GitOps state for my cluster using flux v2
K3S multi-arch highly available cluster installed via Ansible on Proxmox VMs.
The cluster is designed to allow tearing it completely without any data lost.
Stack is ordered in multiple layers (Flux kustomizations) depending on the lower one (example apps depend on infrasteructure).
Installed via Ansible. It creates the VMs for the 3 nodes
The cluster is designed to allow tearing the cluster completly without any data lost.
Master secret is stored in Ansible Vault.
Kubernetes passwords and secrets encrypted with mozilla SOPS which it is supported out of the box in Flux2.
GPG key is deployed via Ansible. Its hash must be kept in sync with .sops.yaml.
Based on Vaskozl I use a pre-commit hook to ensure that secrets are never pushed unencrypted. The hook is deployed by running cd scripts; ./install_git_hooks.sh
To encrypt files with secrets use:
sops -e -i my-secret.yaml # Initial encrypt
sops my-secret.yaml # To edit it directly in you $EDITOR
Delete stuck objects (PVs, PVCs)
kubectl patch <object type> <object name> -p '{"metadata":{"finalizers": []}}' --type=merge
Delete stuck NSs
NAMESPACE=your-rogue-namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >/tmp/patch.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @/tmp/patch.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
This cluster in inspired by the work of others shared at awesome-home-kubernetes. These projects can be searched in GitHub. They include the k8s-at-home topic.
There is also an active k8s@home Discord for this community.