Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kerwanp/hetzner-k8s-terraform-module

Create Kubernetes Clusters on Hetzner Cloud with ease
https://github.com/kerwanp/hetzner-k8s-terraform-module

Last synced: 11 days ago
JSON representation

Create Kubernetes Clusters on Hetzner Cloud with ease

Awesome Lists containing this project

README

        

# Hetzner Kubernetes Terraform Module

This Terraform module allows you to bootstrap self-managed clusters on Hetzner Cloud in no time. Perfect for labs.

> ⚠ This is not battle tested, use it are your own risks.

## Features

- ✅ Cheap nodes thanks to [Hetzner Cloud](https://www.hetzner.com/) pricing
- ✅ Automatically creates and joins new nodes
- ✅ Manages Persistent volume claims by using Hetzner [Cloud Storage Interface driver](https://github.com/hetznercloud/csi-driver)
- ✅ Manages Load balancer by using Hetzner [Cloud Controller Manager](https://github.com/hetznercloud/hcloud-cloud-controller-manager)

## Example

```hcl
provider "hcloud" {
token = var.hcloud_token
}

resource "hcloud_ssh_key" "personal" {
name = "Personal"
public_key = file("~/.ssh/id_ed25519.pub")
}

module "cluster" {
source = "../"

name = "my-cluster"
ssh_key = hcloud_ssh_key.personal.id

hcloud_token = var.hcloud_token

cidr = "10.0.0.0/16"
zone = "nbg1"

master = {
server_type = "cpx21"
}

agents = {
0 = {
server_type = "cpx21"
}
}
}

resource "local_sensitive_file" "kubeconfig" {
content = module.cluster.kubeconfig.content
filename = "kubeconfig.yaml"
}
```

## Inputs

| Name | Description | Type | Default | Required |
| --------------------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | ------- | :------: |
| [agents](#input_agents) | Map of agents configurations |

map(object({
server_type = string
}))
| `{}` | no |
| [ccm](#input_ccm) | Hetzner Cloud Controller Manager configuration | `any` | `null` | no |
| [cidr](#input_cidr) | IP addresses range for the private network | `string` | n/a | yes |
| [csi](#input_csi) | Hetzner Container Storage Interface configuration | `any` | `null` | no |
| [flannel](#input_flannel) | Flannel configuration | `any` | `null` | no |
| [hcloud_token](#input_hcloud_token) | The Hetzner Cloud API token | `string` | n/a | yes |
| [master](#input_master) | Master configuration |
object({
server_type = string
})
| n/a | yes |
| [name](#input_name) | The name of the cluster used to prefix resources | `string` | n/a | yes |
| [ssh_key](#input_ssh_key) | SSH Key ID or name that will be added to created servers | `string` | n/a | yes |
| [zone](#input_zone) | Zone where resources will be created | `string` | n/a | yes |

## Outputs

| Name | Description |
| ----------------------------------------------------------------- | ----------- |
| [kubeconfig](#output_kubeconfig) | n/a |