Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions kube.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module "kube-hetzner" {

# Using the default configuration you can only create a maximum of 42 agent-nodepools.
# This is due to the creation of a subnet for each nodepool with CIDRs being in the shape of 10.[nodepool-index].0.0/16 which collides with k3s' cluster and service IP ranges (defaults below).
# To create additional ones (or if you want to use different ranges for other reasons), set the `subnet_ip_range` explicitly for a node pool.
# Furthermore the maximum number of nodepools (controlplane and agent) is 50, due to a hard limit of 50 subnets per network, see https://docs.hetzner.com/cloud/networks/faq/.
# So to be able to create a maximum of 50 nodepools in total, the values below have to be changed to something outside that range, e.g. `10.200.0.0/16` and `10.201.0.0/16` for cluster and service respectively.

Expand Down Expand Up @@ -187,12 +188,13 @@ module "kube-hetzner" {

agent_nodepools = [
{
name = "agent-small",
server_type = "cx22",
location = "fsn1",
labels = [],
taints = [],
count = 1
name = "agent-small",
server_type = "cx22",
location = "fsn1",
labels = [],
taints = [],
count = 1
subnet_ip_range = "10.0.0.0/16"
# swap_size = "2G" # remember to add the suffix, examples: 512M, 1G
# zram_size = "2G" # remember to add the suffix, examples: 512M, 1G
# kubelet_args = ["kube-reserved=cpu=50m,memory=300Mi,ephemeral-storage=1Gi", "system-reserved=cpu=250m,memory=300Mi"]
Expand All @@ -210,6 +212,7 @@ module "kube-hetzner" {
labels = [],
taints = [],
count = 1
subnet_ip_range = "10.100.0.0/16"

# Fine-grained control over placement groups (nodes in the same group are spread over different physical servers, 10 nodes per placement group max):
# placement_group = "default"
Expand Down Expand Up @@ -340,7 +343,7 @@ module "kube-hetzner" {
# easier, as all public traffic passes through a single strongly secured node. It does
# however also introduce a single point of failure, so if you need high-availability on your
# egress, you should consider other configurations.
#
#
#
# nat_router = {
# server_type = "cax21"
Expand Down
3 changes: 1 addition & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "hcloud_network_subnet" "agent" {
network_id = data.hcloud_network.k3s.id
type = "cloud"
network_zone = var.network_region
ip_range = local.network_ipv4_subnets[count.index]
ip_range = coalesce(var.agent_nodepools[count.index].subnet_ip_range, local.network_ipv4_subnets[count.index])
}

# Subnet for NAT router and other peripherals
Expand Down Expand Up @@ -79,4 +79,3 @@ resource "hcloud_firewall" "k3s" {
}
}
}

1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ variable "agent_nodepools" {
selinux = optional(bool, true)
placement_group_compat_idx = optional(number, 0)
placement_group = optional(string, null)
subnet_ip_range = optional(string, null)
count = optional(number, null)
disable_ipv4 = optional(bool, false)
disable_ipv6 = optional(bool, false)
Expand Down