This project has been a long journey. If you want to read the full story, from the unboxing of the Turing Pi 2 to the final setup, you can read it here.
To work with this cluster, you will need to install the following tools:
- kubectl: The Kubernetes command-line tool, allows you to run commands against Kubernetes clusters. You can find the installation guide here.
- helm: A package manager for Kubernetes, which helps you manage Kubernetes applications. You can find the installation guide here.
- sops: A tool for managing secrets with encryption. You can find the installation guide here.
This repository contains the configuration for a home Kubernetes cluster running on a Turing Pi 2. It includes the necessary files to deploy various services, from storage to media servers.
The k3s cluster is installed using Ansible and the k3s-ansible playbook.
-
First, clone the
k3s-ansiblerepository:git clone https://github.com/k3s-io/k3s-ansible.git
-
Navigate into the cloned directory:
cd k3s-ansible -
Run the ansible playbook with the
inventory.ymlfrom this repository. Make sure to replace/path/to/turing-pi-serverwith the actual path to this repository on your local machine.ansible-playbook site.yml -i /path/to/turing-pi-server/config/inventory.yml
Before you can deploy the services, you need to set up the cluster's core components. This involves installing MetalLB, an Nginx Ingress Controller, and CoreDNS.
MetalLB provides a network load-balancer for bare-metal Kubernetes clusters.
helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb --namespace metallb-system --create-namespaceThe Nginx Ingress Controller uses NGINX as a reverse proxy and load balancer.
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespaceTo deploy all services, including the centralized secrets:
./deploy-services.shTo deploy a single service manually, you must include the global values file to ensure secrets (like regcred) are configured correctly:
# Standard deployment
helm upgrade -i <service-name> ./services/<service-name> -f config/global-values.yaml
# Deployment with SOPS secrets
helm secrets upgrade -i <service-name> ./services/<service-name> -f config/global-values.yaml -f ./services/<service-name>/secrets.yaml- Skip Deployment: Start your commit message with
[skip-deploy]to skip the deployment step in the pipeline. - Parallel Detection: The pipeline checks for changes in
services/andconfig/(storage/secrets) in parallel. - Global Secrets:
cluster-secretsare automatically deployed if changes are detected inconfig/secrets.
CoreDNS is a flexible and extensible DNS server for your cluster.
helm install coredns coredns/coredns \
--namespace=kube-system \
--set service.clusterIP=10.43.0.10 \
--set service.name=kube-dns \
--set isClusterService=true \
--set serviceType=ClusterIP \
--set prometheus.service.enabled=true \
--set kubernetes.clusterDomain=cluster.localThe storage is managed via Helm and supports both NFS and NAS configurations. You can deploy it using the following command:
helm install storage ./config/storageYou can customize the storage configuration by modifying the values.yaml file in the config/storage directory.
This repository includes Helm charts for various applications. You can find them in the services directory. To deploy an application, use the helm install command with the appropriate chart.
./deploy-services.shContributions, issues and feature requests are welcome! Feel free to check issues page.
This project is MIT licensed.
