+0
日增长
5,659
stars
252
forks
105
watchers
23
prs
75
issues
0
releases
README
Kubernetes clusters for the hobbyist
This guide answers the question of how to setup and operate a fully functional, secure Kubernetes cluster on a cloud provider such as Hetzner Cloud, DigitalOcean or Scaleway. It explains how to overcome the lack of external ingress controllers, fully isolated secure private networking and persistent distributed block storage.
Be aware, that the following sections might be opinionated. Kubernetes is an evolving, fast paced environment, which means this guide will probably be outdated at times, depending on the author's spare time and individual contributions. Due to this fact contributions are highly appreciated.
This guide is accompanied by a fully automated cluster setup solution in the shape of well structured, modular Terraform recipes. Links to contextually related modules are spread throughout the guide, visually highlighted using the !Terraform Terraform icon.
If you find this project helpful, please consider supporting its future development on GitHub Sponsors.
Table of Contents
- Cluster size
- Choosing a cloud provider
- Choosing an operating system
- Security
- Firewall
- Secure private networking
- WireGuard setup
- Installing Kubernetes
- Containerd setup
- Etcd setup
- Kubernetes setup
- Initializing the master node
- Joining the cluster nodes
- Access and operations
- Role-Based Access Control
- Deploying services
- Bringing traffic to the cluster
- Ingress controller setup
- DNS records
- Obtaining SSL/TLS certificates
- Deploying the Kubernetes Dashboard
- Distributed block storage
- Persistent volumes
- Choosing a solution
- Deploying Rook
- Consuming storage
- Where to go from here
Cluster size
The professional hobbyist cluster operators aim for resilience—a system's ability to withstand and recover from failure. On the other hand, they usually have a limited amount of funds they can or want to spend on a basic cluster. It's therefore crucial to find a good balance between resilience and cost.
After experimenting with various setups and configurations a good reference point is, that a basic cluster can be operated on as little as two virtual hosts with 1GB memory each. At this point it's worth mentioning that Kubernetes does not include swap memory in its calculations and will evict pods pretty brutally when reaching memory limits (reference). As opposed to memory, raw CPU power doesn't matter that much, although it should be clear that the next Facebook won't be running on two virtual CPU cores.
For a Kubernetes cluster to be resilient it's recommended that it consists of at least three hosts. The main reason behind this is that etcd, which itself is an essential part of any Kubernetes setup, is only fault tolerant with a minimum of three cluster members (reference).
Choosing a cloud provider
!Terraform provider/hcloud
!Terraform provider/digitalocean
!Terraform provider/scaleway
At this point it's time to choose a cloud provider bTop issues
#90Unable to resize persistent volume with rook7 comments · 2021-07-28#78Hetzner now supports private networking6 comments · 2019-08-13#6Consider securing etcd6 comments · 2017-05-08#74Issues when installing and how I solved them4 comments · 2019-05-26#68Can we add a node without destroying the whole setup?4 comments · 2019-03-11#88Rook block device not working for ReadWriteMany3 comments · 2021-04-21#84Consider adding Tokenrequest2 comments · 2020-05-22#72Hetzner Volumes via CSI driver1 comments · 2019-04-28