Skip to content

dmalykh/hetzner_k3s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform module for creating K3S cluster using Hetzner cloud services.

module "infrastructure" {
 source  = "github.com/dmalykh/hetzner_k3s"
 
 hcloud_token = "${var.hcloud_token}"
 os = "ubuntu-22.04"
 location = "hel1"

 ssh_key = {
    public_key = "${var.public_key}"
    private_key = file("${var.private_key}")
 }

 master = {
    count = 3
    server_type = "cx21"
 }

 agent = {
    count = 6
    server_type = "cx11"
 }
}

resource "local_sensitive_file" "kubeconfig_file" {
    content = module.infrastructure.kube_config
    filename = "./.kubeconfig"
}

Requirements

Name Version
hcloud 1.35.2

Providers

Name Version
hcloud 1.35.2
kubernetes n/a
template n/a

Modules

Name Source Version
k3s [email protected]:dmalykh/terraform-module-k3s.git n/a

Resources

Name Type
hcloud_network.private resource
hcloud_network_subnet.private_subnet resource
hcloud_server.agent resource
hcloud_server.master resource
hcloud_server_network.agent resource
hcloud_server_network.master resource
hcloud_ssh_key.default resource
kubernetes_cluster_role_binding.boostrap resource
kubernetes_service_account.bootstrap resource
hcloud_image.os data source
kubernetes_secret.sa_credentials data source
template_file.init data source

Inputs

Name Description Type Default Required
agent Agent nodes
object({
count = optional(number, 0)
name = optional(string, "agent")
server_type = string
})
n/a yes
cidr K3s network CIDRs (see https://rancher.com/docs/k3s/latest/en/installation/install-options/).
object({
pods = string
services = string
})
{
"pods": "10.42.0.0/16",
"services": "10.43.0.0/16"
}
no
cloud-init n/a string "" no
hcloud_token n/a string n/a yes
ipadd Add to IP addresses sequesce to avoid zero-ip defenition number 1 no
location n/a string "hel1" no
master Control plane nodes
object({
count = optional(number, 0)
name = optional(string, "master")
server_type = string
})
n/a yes
networking n/a
object({
name = optional(string, "private")
ip_range = optional(string, "10.0.0.0/8")
type = optional(string, "cloud")
network_zone = optional(string, "eu-central")
sub_ip_range = optional(string, "10.254.1.0/24")
})
{} no
os Operating system that will be installed on a server string "ubuntu-22.04" no
ssh_key n/a
object({
name = optional(string, "default")
public_key = string
private_key = string
})
n/a yes

Outputs

Name Description
bootstrap_sa Bootstrap ServiceAccount. Can be used by Terraform to provision this cluster.
kube_config n/a
summary Output

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages