☁️ Private Cloud @Hetzner

January 30, 2024 (3mo ago)

Cluster Documentation

Overview

This documentation provides an overview of the K3S cluster deployed for personal and non-commercial purposes in a homelab environment. I have been using this cluster for 3 months and have had a very good experience so far. The cluster is hosted at Hetzner in Germany and is configured as a private cloud. The infrastructure is created using Terraform and the Hetzner Cloud API. The cluster is designed to be highly available (HA) with three master nodes (CAX21). Additional worker nodes can be easily integrated to accommodate high usage.

Infrastructure Details

  • Cloud Provider: Hetzner
  • Cluster Orchestration: K3S
  • Infrastructure as Code: Terraform
  • High Availability Configuration: 3 Master Nodes (CAX21)
  • Scalability: Additional worker nodes can be added as needed
  • Architecture: ARM64 for increased logical CPU cores with cost efficiency

Infrastructure Setup

The infrastructure is set up using Terraform and the Hetzner Cloud API. The Terraform configuration defines the desired state of the infrastructure, including the number of master and worker nodes, network settings, and other parameters. The HA configuration ensures that the cluster remains resilient and available even in the case of node failures.

Networking and Ingress

Ingress Controller

Traefik is used as the ingress controller for the K3S cluster. Traefik efficiently manages incoming traffic, distributing requests to the appropriate services within the cluster. This facilitates seamless communication between external users and the deployed applications.

DNS Configuration

Round-robin DNS is employed for load balancing and distributing traffic across multiple nodes. This setup enhances the availability and performance of the services hosted on the cluster. Their exists also a health check which removes the DNS entry if the node is not reachable. The TTL for the cluster Domains is therefore also quite low. An LB could be more reliable and results in lower DNS requests on client side but for now this kind of non-commercial usage this setup it suitable.

Deployment Process

GitHub Integration

The entire setup is managed through GitHub, leveraging GitHub Organizations. My non-commercial GitHub organization, owl-inventions, is utilized to organize and manage repositories containing the codebase for various services and projects. The GitHub repository serves as the central hub for version control, CI/CD workflows, and collaborative development.

CI/CD Pipelines

All services hosted on the K3S cluster are CI/CD driven. The CI/CD pipelines are configured within the GitHub Actions workflow. This automated process ensures that code changes are built, tested, and deployed seamlessly, promoting a streamlined development and deployment cycle.

Conclusion

The K3S cluster, hosted on Hetzner in Germany, provides a reliable and cost-effective infrastructure for personal and non-commercial projects. Leveraging ARM64 architecture, GitHub organization features, and robust CI/CD pipelines, the cluster is optimized for efficiency, scalability, and ease of management. As the project evolves, additional worker nodes can be seamlessly integrated to accommodate growing demands.

⚙️️

Kubernetes, K3S, Helm, Docker, CI/CD, HCloud, GitHub Actions, GitOps, Terraform, Ansible, Prometheus, Grafana

v1.2.0