···11+# Local .terraform directories
22+**/.terraform/*
33+44+# .tfstate files
55+*.tfstate
66+*.tfstate.*
77+88+# Crash log files
99+crash.log
1010+crash.*.log
1111+1212+# Exclude all .tfvars files, which are likely to contain sensitive data, such as
1313+# password, private keys, and other secrets. These should not be part of version
1414+# control as they are data-based configuration files and not code.
1515+*.tfvars
1616+*.tfvars.json
1717+1818+# Ignore override files as they are usually used to override resources locally and so
1919+# are not considered part of the primary codebase
2020+override.tf
2121+override.tf.json
2222+*_override.tf
2323+*_override.tf.json
2424+2525+# Include override files you do want to forestall terraform from ignoring
2626+# !example_override.tf
2727+2828+# Include lock file if you want to lock the providers
2929+# !.terraform.lock.hcl
3030+3131+# Backup files
3232+*.yaml.backup
3333+k3s_kustomization_backup.yaml
···11+/*
22+ * Creates a MicroOS snapshot for Kube-Hetzner
33+ */
44+packer {
55+ required_plugins {
66+ hcloud = {
77+ version = ">= 1.0.5"
88+ source = "github.com/hetznercloud/hcloud"
99+ }
1010+ }
1111+}
1212+1313+variable "hcloud_token" {
1414+ type = string
1515+ default = env("HCLOUD_TOKEN")
1616+ sensitive = true
1717+}
1818+1919+# We download the OpenSUSE MicroOS x86 image from an automatically selected mirror.
2020+variable "opensuse_microos_x86_mirror_link" {
2121+ type = string
2222+ default = "https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-ContainerHost-OpenStack-Cloud.qcow2"
2323+}
2424+2525+# We download the OpenSUSE MicroOS ARM image from an automatically selected mirror.
2626+variable "opensuse_microos_arm_mirror_link" {
2727+ type = string
2828+ default = "https://download.opensuse.org/ports/aarch64/tumbleweed/appliances/openSUSE-MicroOS.aarch64-ContainerHost-OpenStack-Cloud.qcow2"
2929+}
3030+3131+# If you need to add other packages to the OS, do it here in the default value, like ["vim", "curl", "wget"]
3232+# When looking for packages, you need to search for OpenSUSE Tumbleweed packages, as MicroOS is based on Tumbleweed.
3333+variable "packages_to_install" {
3434+ type = list(string)
3535+ default = []
3636+}
3737+3838+locals {
3939+ needed_packages = join(" ", concat(["restorecond policycoreutils policycoreutils-python-utils setools-console audit bind-utils wireguard-tools fuse open-iscsi nfs-client xfsprogs cryptsetup lvm2 git cifs-utils bash-completion mtr tcpdump udica qemu-guest-agent"], var.packages_to_install))
4040+4141+ # Add local variables for inline shell commands
4242+ download_image = "wget --timeout=5 --waitretry=5 --tries=5 --retry-connrefused --inet4-only "
4343+4444+ write_image = <<-EOT
4545+ set -ex
4646+ echo 'MicroOS image loaded, writing to disk... '
4747+ qemu-img convert -p -f qcow2 -O host_device $(ls -a | grep -ie '^opensuse.*microos.*qcow2$') /dev/sda
4848+ echo 'done. Rebooting...'
4949+ sleep 1 && udevadm settle && reboot
5050+ EOT
5151+5252+ install_packages = <<-EOT
5353+ set -ex
5454+ echo "First reboot successful, installing needed packages..."
5555+ transactional-update --continue pkg install -y ${local.needed_packages}
5656+ transactional-update --continue shell <<- EOF
5757+ setenforce 0
5858+ rpm --import https://rpm.rancher.io/public.key
5959+ zypper install -y https://github.com/k3s-io/k3s-selinux/releases/download/v1.6.stable.1/k3s-selinux-1.6-1.sle.noarch.rpm
6060+ zypper addlock k3s-selinux
6161+ restorecon -Rv /etc/selinux/targeted/policy
6262+ restorecon -Rv /var/lib
6363+ setenforce 1
6464+ EOF
6565+ sleep 1 && udevadm settle && reboot
6666+ EOT
6767+6868+ clean_up = <<-EOT
6969+ set -ex
7070+ echo "Second reboot successful, cleaning-up..."
7171+ rm -rf /etc/ssh/ssh_host_*
7272+ echo "Make sure to use NetworkManager"
7373+ touch /etc/NetworkManager/NetworkManager.conf
7474+ sleep 1 && udevadm settle
7575+ EOT
7676+}
7777+7878+# Source for the MicroOS x86 snapshot
7979+source "hcloud" "microos-x86-snapshot" {
8080+ image = "ubuntu-24.04"
8181+ rescue = "linux64"
8282+ location = "nbg1"
8383+ server_type = "cx23" # disk size of >= 40GiB is needed to install the MicroOS image
8484+ snapshot_labels = {
8585+ microos-snapshot = "yes"
8686+ creator = "kube-hetzner"
8787+ }
8888+ snapshot_name = "OpenSUSE MicroOS x86 by Kube-Hetzner"
8989+ ssh_username = "root"
9090+ token = var.hcloud_token
9191+}
9292+9393+# Source for the MicroOS ARM snapshot
9494+source "hcloud" "microos-arm-snapshot" {
9595+ image = "ubuntu-24.04"
9696+ rescue = "linux64"
9797+ location = "nbg1"
9898+ server_type = "cax11" # disk size of >= 40GiB is needed to install the MicroOS image
9999+ snapshot_labels = {
100100+ microos-snapshot = "yes"
101101+ creator = "kube-hetzner"
102102+ }
103103+ snapshot_name = "OpenSUSE MicroOS ARM by Kube-Hetzner"
104104+ ssh_username = "root"
105105+ token = var.hcloud_token
106106+}
107107+108108+# Build the MicroOS x86 snapshot
109109+build {
110110+ sources = ["source.hcloud.microos-x86-snapshot"]
111111+112112+ # Download the MicroOS x86 image
113113+ provisioner "shell" {
114114+ inline = ["${local.download_image}${var.opensuse_microos_x86_mirror_link}"]
115115+ }
116116+117117+ # Write the MicroOS x86 image to disk
118118+ provisioner "shell" {
119119+ inline = [local.write_image]
120120+ expect_disconnect = true
121121+ }
122122+123123+ # Ensure connection to MicroOS x86 and do house-keeping
124124+ provisioner "shell" {
125125+ pause_before = "5s"
126126+ inline = [local.install_packages]
127127+ expect_disconnect = true
128128+ }
129129+130130+ # Ensure connection to MicroOS x86 and do house-keeping
131131+ provisioner "shell" {
132132+ pause_before = "5s"
133133+ inline = [local.clean_up]
134134+ }
135135+}
136136+137137+# Build the MicroOS ARM snapshot
138138+build {
139139+ sources = ["source.hcloud.microos-arm-snapshot"]
140140+141141+ # Download the MicroOS ARM image
142142+ provisioner "shell" {
143143+ inline = ["${local.download_image}${var.opensuse_microos_arm_mirror_link}"]
144144+ }
145145+146146+ # Write the MicroOS ARM image to disk
147147+ provisioner "shell" {
148148+ inline = [local.write_image]
149149+ expect_disconnect = true
150150+ }
151151+152152+ # Ensure connection to MicroOS ARM and do house-keeping
153153+ provisioner "shell" {
154154+ pause_before = "5s"
155155+ inline = [local.install_packages]
156156+ expect_disconnect = true
157157+ }
158158+159159+ # Ensure connection to MicroOS ARM and do house-keeping
160160+ provisioner "shell" {
161161+ pause_before = "5s"
162162+ inline = [local.clean_up]
163163+ }
164164+}
keypair/id_ed25519_tub
This is a binary file and will not be displayed.
keypair/id_ed25519_tub.pub
This is a binary file and will not be displayed.
+1158
kube.tf
···11+locals {
22+ # You have the choice of setting your Hetzner API token here or define the TF_VAR_hcloud_token env
33+ # within your shell, such as: export TF_VAR_hcloud_token=xxxxxxxxxxx
44+ # If you choose to define it in the shell, this can be left as is.
55+66+ # Your Hetzner token can be found in your Project > Security > API Token (Read & Write is required).
77+ hcloud_token = "xxxxxxxxxxx"
88+}
99+1010+module "kube-hetzner" {
1111+ providers = {
1212+ hcloud = hcloud
1313+ }
1414+ hcloud_token = var.hcloud_token != "" ? var.hcloud_token : local.hcloud_token
1515+1616+ # Then fill or edit the below values. Only the first values starting with a * are obligatory; the rest can remain with their default values, or you
1717+ # could adapt them to your needs.
1818+1919+ # * source can be specified in multiple ways:
2020+ # 1. For normal use, (the official version published on the Terraform Registry), use
2121+ source = "kube-hetzner/kube-hetzner/hcloud"
2222+ # When using the terraform registry as source, you can optionally specify a version number.
2323+ # See https://registry.terraform.io/modules/kube-hetzner/kube-hetzner/hcloud for the available versions
2424+ # version = "2.15.3"
2525+ # 2. For local dev, path to the git repo
2626+ # source = "../../kube-hetzner/"
2727+ # 3. If you want to use the latest master branch (see https://developer.hashicorp.com/terraform/language/modules/sources#github), use
2828+ # source = "github.com/kube-hetzner/terraform-hcloud-kube-hetzner"
2929+3030+ # Note that some values, notably "location" and "public_key" have no effect after initializing the cluster.
3131+ # This is to keep Terraform from re-provisioning all nodes at once, which would lose data. If you want to update
3232+ # those, you should instead change the value here and manually re-provision each node. Grep for "lifecycle".
3333+3434+ # Customize the SSH port (by default 22)
3535+ # ssh_port = 2222
3636+3737+ # * Your ssh public key
3838+ ssh_public_key = file("./keypair/id_ed25519_tub.pub")
3939+ # * Your private key must be "ssh_private_key = null" when you want to use ssh-agent for a Yubikey-like device authentication or an SSH key-pair with a passphrase.
4040+ # For more details on SSH see https://github.com/kube-hetzner/kube-hetzner/blob/master/docs/ssh.md
4141+ ssh_private_key = file("./keypair/id_ed25519_tub")
4242+ # You can add additional SSH public Keys to grant other team members root access to your cluster nodes.
4343+ # ssh_additional_public_keys = []
4444+4545+ # You can also add additional SSH public Keys which are saved in the hetzner cloud by a label.
4646+ # See https://docs.hetzner.cloud/#label-selector
4747+ # ssh_hcloud_key_label = "role=admin"
4848+4949+ # If you use SSH agent and have issues with SSH connecting to your nodes, you can increase the number of auth tries (default is 2)
5050+ # ssh_max_auth_tries = 10
5151+5252+ # If you want to use an ssh key that is already registered within hetzner cloud, you can pass its id.
5353+ # If no id is passed, a new ssh key will be registered within hetzner cloud.
5454+ # It is important that exactly this key is passed via `ssh_public_key` & `ssh_private_key` variables.
5555+ # hcloud_ssh_key_id = ""
5656+5757+ # These can be customized, or left with the default values
5858+ # * For Hetzner locations see https://docs.hetzner.com/general/others/data-centers-and-connection/
5959+ network_region = "eu-central" # change to `us-east` if location is ash
6060+6161+ # If you want to create the private network before calling this module,
6262+ # you can do so and pass its id here. For example if you want to use a proxy
6363+ # which only listens on your private network. Advanced use case.
6464+ #
6565+ # NOTE1: make sure to adapt network_ipv4_cidr, cluster_ipv4_cidr, and service_ipv4_cidr accordingly.
6666+ # If your network is created with 10.0.0.0/8, and you use subnet 10.128.0.0/9 for your
6767+ # non-k3s business, then adapting `network_ipv4_cidr = "10.0.0.0/9"` should be all you need.
6868+ #
6969+ # NOTE2: square brackets! This must be a list of length 1.
7070+ #
7171+ # existing_network_id = [hcloud_network.your_network.id]
7272+7373+ # If you must change the network CIDR you can do so below, but it is highly advised against.
7474+ # network_ipv4_cidr = "10.0.0.0/8"
7575+7676+ # Using the default configuration you can only create a maximum of 42 agent-nodepools.
7777+ # 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).
7878+ # 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/.
7979+ # 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.
8080+8181+ # If you must change the cluster CIDR you can do so below, but it is highly advised against.
8282+ # Never change this value after you already initialized a cluster. Complete cluster redeploy needed!
8383+ # The cluster CIDR must be a part of the network CIDR!
8484+ # cluster_ipv4_cidr = "10.42.0.0/16"
8585+8686+ # If you must change the service CIDR you can do so below, but it is highly advised against.
8787+ # Never change this value after you already initialized a cluster. Complete cluster redeploy needed!
8888+ # The service CIDR must be a part of the network CIDR!
8989+ # service_ipv4_cidr = "10.43.0.0/16"
9090+9191+ # If you must change the service IPv4 address of core-dns you can do so below, but it is highly advised against.
9292+ # Never change this value after you already initialized a cluster. Complete cluster redeploy needed!
9393+ # The service IPv4 address must be part of the service CIDR!
9494+ # cluster_dns_ipv4 = "10.43.0.10"
9595+9696+ # For the control planes, at least three nodes are the minimum for HA. Otherwise, you need to turn off the automatic upgrades (see README).
9797+ # **It must always be an ODD number, never even!** Search the internet for "split-brain problem with etcd" or see https://rancher.com/docs/k3s/latest/en/installation/ha-embedded/
9898+ # For instance, one is ok (non-HA), two is not ok, and three is ok (becomes HA). It does not matter if they are in the same nodepool or not! So they can be in different locations and of various types.
9999+100100+ # Of course, you can choose any number of nodepools you want, with the location you want. The only constraint on the location is that you need to stay in the same network region, Europe, or the US.
101101+ # For the server type, the minimum instance supported is cx23. If you want to use arm64 use cax11; see https://www.hetzner.com/cloud.
102102+103103+ # IMPORTANT: Before you create your cluster, you can do anything you want with the nodepools, but you need at least one of each, control plane and agent.
104104+ # Once the cluster is up and running, you can change nodepool count and even set it to 0 (in the case of the first control-plane nodepool, the minimum is 1).
105105+ # You can also rename it (if the count is 0), but do not remove a nodepool from the list.
106106+107107+ # You can safely add or remove nodepools at the end of each list. That is due to how subnets and IPs get allocated (FILO).
108108+ # The maximum number of nodepools you can create combined for both lists is 50 (see above).
109109+ # Also, before decreasing the count of any nodepools to 0, it's essential to drain and cordon the nodes in question. Otherwise, it will leave your cluster in a bad state.
110110+111111+ # Before initializing the cluster, you can change all parameters and add or remove any nodepools. You need at least one nodepool of each kind, control plane, and agent.
112112+ # ⚠️ The nodepool names are entirely arbitrary, but all lowercase, no special characters or underscore (dashes are allowed), and they must be unique.
113113+114114+ # If you want to have a single node cluster, have one control plane nodepools with a count of 1, and one agent nodepool with a count of 0.
115115+116116+ # Please note that changing labels and taints after the first run will have no effect. If needed, you can do that through Kubernetes directly.
117117+118118+ # Multi-architecture clusters are OK for most use cases, as container underlying images tend to be multi-architecture too.
119119+120120+ # * Example below:
121121+122122+ control_plane_nodepools = [
123123+ {
124124+ name = "control-plane",
125125+ server_type = "cx33",
126126+ location = "nbg1",
127127+ labels = [],
128128+ taints = [],
129129+ count = 1
130130+ }
131131+ ]
132132+133133+ agent_nodepools = []
134134+135135+ # Add additional configuration options for control planes here.
136136+ # E.g to enable monitoring for etcd, proxy etc:
137137+ # control_planes_custom_config = {
138138+ # etcd-expose-metrics = true,
139139+ # kube-controller-manager-arg = "bind-address=0.0.0.0",
140140+ # kube-proxy-arg ="metrics-bind-address=0.0.0.0",
141141+ # kube-scheduler-arg = "bind-address=0.0.0.0",
142142+ # }
143143+144144+ # Add additional configuration options for agent nodes and autoscaler nodes here.
145145+ # E.g to enable monitoring for proxy:
146146+ # agent_nodes_custom_config = {
147147+ # kube-proxy-arg ="metrics-bind-address=0.0.0.0",
148148+ # }
149149+150150+ # You can enable encrypted wireguard for the CNI by setting this to "true". Default is "false".
151151+ # FYI, Hetzner says "Traffic between cloud servers inside a Network is private and isolated, but not automatically encrypted."
152152+ # Source: https://docs.hetzner.com/cloud/networks/faq/#is-traffic-inside-hetzner-cloud-networks-encrypted
153153+ # It works with all CNIs that we support.
154154+ # Just note, that if Cilium with cilium_values, the responsibility of enabling of disabling Wireguard falls on you.
155155+ # enable_wireguard = true
156156+157157+ # * LB location and type, the latter will depend on how much load you want it to handle, see https://www.hetzner.com/cloud/load-balancer
158158+ load_balancer_type = "lb11"
159159+ load_balancer_location = "nbg1"
160160+161161+ # Disable IPv6 for the load balancer, the default is false.
162162+ # load_balancer_disable_ipv6 = true
163163+164164+ # Disables the public network of the load balancer. (default: false).
165165+ # load_balancer_disable_public_network = true
166166+167167+ # Specifies the algorithm type of the load balancer. (default: round_robin).
168168+ # load_balancer_algorithm_type = "least_connections"
169169+170170+ # Specifies the interval at which a health check is performed. Minimum is 3s (default: 15s).
171171+ # load_balancer_health_check_interval = "5s"
172172+173173+ # Specifies the timeout of a single health check. Must not be greater than the health check interval. Minimum is 1s (default: 10s).
174174+ # load_balancer_health_check_timeout = "3s"
175175+176176+ # Specifies the number of times a health check is retried before a target is marked as unhealthy. (default: 3)
177177+ # load_balancer_health_check_retries = 3
178178+179179+180180+ # Setup a NAT router, and automatically disable public ips on all control plane and agent nodes.
181181+ # To use this, you must also set use_control_plane_lb = true, otherwise kubectl can never
182182+ # reach the cluster. The NAT router will also function as bastion. This makes securing the cluster
183183+ # easier, as all public traffic passes through a single strongly secured node. It does
184184+ # however also introduce a single point of failure, so if you need high-availability on your
185185+ # egress, you should consider other configurations.
186186+ #
187187+ # Hetzner removed the DHCP Router option from private networks on 2025-08-11, so the module
188188+ # now ensures each node attached to the private network persists a default route via the
189189+ # virtual gateway. No manual `ip route add` is required after reboots or DHCP renewals.
190190+ #
191191+ #
192192+ # nat_router = {
193193+ # server_type = "cax21"
194194+ # location = "nbg1"
195195+ # enable_sudo = false # optional, default to false. Set to true to add nat-router user to the sudo'ers. Note that ssh as root is disabled.
196196+ # labels = {} # optionally add labels.
197197+ # }
198198+199199+200200+ ### The following values are entirely optional (and can be removed from this if unused)
201201+202202+ # You can refine a base domain name to be use in this form of nodename.base_domain for setting the reverse dns inside Hetzner
203203+ # base_domain = "mycluster.example.com"
204204+205205+ # Cluster Autoscaler
206206+ # Providing at least one map for the array enables the cluster autoscaler feature, default is disabled.
207207+ # ⚠️ Based on how the autoscaler works with this project, you can only choose either x86 instances or ARM server types for ALL autoscaler nodepools.
208208+ # If you are curious, it's ok to have a multi-architecture cluster, as most underlying container images are multi-architecture too.
209209+ #
210210+ # ⚠️ Setting labels and taints will only work on cluster-autoscaler images versions released after > 20 October 2023. Or images built from master after that date.
211211+ #
212212+ # * Example below:
213213+ # autoscaler_nodepools = [
214214+ # {
215215+ # name = "autoscaled-small"
216216+ # server_type = "cx33"
217217+ # location = "nbg1"
218218+ # # Add the arg --enforce-node-group-min-size=true in the cluster_autoscaler_extra_args option below if you want min_nodes to be effective
219219+ # min_nodes = 0
220220+ # max_nodes = 5
221221+ # labels = {
222222+ # "node.kubernetes.io/role": "peak-workloads"
223223+ # }
224224+ # taints = [
225225+ # {
226226+ # key= "node.kubernetes.io/role"
227227+ # value= "peak-workloads"
228228+ # effect= "NoExecute"
229229+ # }
230230+ # ]
231231+ # # kubelet_args = ["kube-reserved=cpu=250m,memory=1500Mi,ephemeral-storage=1Gi", "system-reserved=cpu=250m,memory=300Mi"]
232232+ # }
233233+ # ]
234234+ #
235235+ # To disable public ips on your autoscaled nodes, uncomment the following lines:
236236+ # autoscaler_disable_ipv4 = true
237237+ # autoscaler_disable_ipv6 = true
238238+239239+ # ⚠️ Deprecated, will be removed after a new Cluster Autoscaler version has been released which support the new way of setting labels and taints. See above.
240240+ # Add extra labels on nodes started by the Cluster Autoscaler
241241+ # This argument is not used if autoscaler_nodepools is not set, because the Cluster Autoscaler is installed only if autoscaler_nodepools is set
242242+ # autoscaler_labels = [
243243+ # "node.kubernetes.io/role=peak-workloads"
244244+ # ]
245245+246246+ # Add extra taints on nodes started by the Cluster Autoscaler
247247+ # This argument is not used if autoscaler_nodepools is not set, because the Cluster Autoscaler is installed only if autoscaler_nodepools is set
248248+ # autoscaler_taints = [
249249+ # "node.kubernetes.io/role=specific-workloads:NoExecute"
250250+ # ]
251251+252252+ # Configuration of the Cluster Autoscaler binary
253253+ #
254254+ # These arguments and variables are not used if autoscaler_nodepools is not set, because the Cluster Autoscaler is installed only if autoscaler_nodepools is set.
255255+ #
256256+ # Image and version of Kubernetes Cluster Autoscaler for Hetzner Cloud:
257257+ # - cluster_autoscaler_image: Image of Kubernetes Cluster Autoscaler for Hetzner Cloud to be used.
258258+ # The default is the official image from the Kubernetes project: registry.k8s.io/autoscaling/cluster-autoscaler
259259+ # - cluster_autoscaler_version: Version of Kubernetes Cluster Autoscaler for Hetzner Cloud. Should be aligned with Kubernetes version.
260260+ # Available versions for the official image can be found at https://explore.ggcr.dev/?repo=registry.k8s.io%2Fautoscaling%2Fcluster-autoscaler
261261+ #
262262+ # Logging related arguments are managed using separate variables:
263263+ # - cluster_autoscaler_log_level: Controls the verbosity of logs (--v), the value is from 0 to 5, default is 4, for max debug info set it to 5.
264264+ # - cluster_autoscaler_log_to_stderr: Determines whether to log to stderr (--logtostderr).
265265+ # - cluster_autoscaler_stderr_threshold: Sets the threshold for logs that go to stderr (--stderrthreshold).
266266+ #
267267+ # Server/node creation timeout variable:
268268+ # - cluster_autoscaler_server_creation_timeout: Sets the timeout (in minutes) until which a newly created server/node has to become available before giving up and destroying it (defaults to 15, unit is minutes)
269269+ #
270270+ # Example:
271271+ #
272272+ # cluster_autoscaler_image = "registry.k8s.io/autoscaling/cluster-autoscaler"
273273+ # cluster_autoscaler_version = "v1.30.3"
274274+ # cluster_autoscaler_log_level = 4
275275+ # cluster_autoscaler_log_to_stderr = true
276276+ # cluster_autoscaler_stderr_threshold = "INFO"
277277+ # cluster_autoscaler_server_creation_timeout = 15
278278+279279+ # Additional Cluster Autoscaler binary configuration
280280+ #
281281+ # cluster_autoscaler_extra_args can be used for additional arguments. The default is an empty array.
282282+ #
283283+ # Please note that following arguments are managed by terraform-hcloud-kube-hetzner or the variables above and should not be set manually:
284284+ # - --v=${var.cluster_autoscaler_log_level}
285285+ # - --logtostderr=${var.cluster_autoscaler_log_to_stderr}
286286+ # - --stderrthreshold=${var.cluster_autoscaler_stderr_threshold}
287287+ # - --cloud-provider=hetzner
288288+ # - --nodes ...
289289+ #
290290+ # See the Cluster Autoscaler FAQ for the full list of arguments: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca
291291+ #
292292+ # Example:
293293+ #
294294+ # cluster_autoscaler_extra_args = [
295295+ # "--ignore-daemonsets-utilization=true",
296296+ # "--enforce-node-group-min-size=true",
297297+ # ]
298298+299299+ # Enable delete protection on compatible resources to prevent accidental deletion from the Hetzner Cloud Console.
300300+ # This does not protect deletion from Terraform itself.
301301+ # enable_delete_protection = {
302302+ # floating_ip = true
303303+ # load_balancer = true
304304+ # volume = true
305305+ # }
306306+307307+ # Enable etcd snapshot backups to S3 storage.
308308+ # Just provide a map with the needed settings (according to your S3 storage provider) and backups to S3 will
309309+ # be enabled (with the default settings for etcd snapshots).
310310+ # Cloudflare's R2 offers 10GB, 10 million reads and 1 million writes per month for free.
311311+ # For proper context, have a look at https://docs.k3s.io/datastore/backup-restore.
312312+ # You also can use additional parameters from https://docs.k3s.io/cli/etcd-snapshot, such as `etc-s3-folder`
313313+ # etcd_s3_backup = {
314314+ # etcd-s3-endpoint = "xxxx.r2.cloudflarestorage.com"
315315+ # etcd-s3-access-key = "<access-key>"
316316+ # etcd-s3-secret-key = "<secret-key>"
317317+ # etcd-s3-bucket = "k3s-etcd-snapshots"
318318+ # etcd-s3-region = "<your-s3-bucket-region|usually required for aws>"
319319+ # }
320320+321321+ # To enable Hetzner Storage Box support, you can enable csi-driver-smb, default is "false".
322322+ # enable_csi_driver_smb = true
323323+ # If you want to specify the version for csi-driver-smb, set it below - otherwise it'll use the latest version available.
324324+ # See https://github.com/kubernetes-csi/csi-driver-smb/releases for the available versions.
325325+ # csi_driver_smb_version = "v1.16.0"
326326+327327+ # To enable iscid without setting enable_longhorn = true, set enable_iscsid = true. You will need this if
328328+ # you install your own version of longhorn outside of this module.
329329+ # Default is false. If enable_longhorn=true, this variable is ignored and iscsid is enabled anyway.
330330+ # enable_iscsid = true
331331+332332+ # To use local storage on the nodes, you can enable Longhorn, default is "false".
333333+ # See a full recap on how to configure agent nodepools for longhorn here https://github.com/kube-hetzner/terraform-hcloud-kube-hetzner/discussions/373#discussioncomment-3983159
334334+ # Also see Longhorn best practices here https://gist.github.com/ifeulner/d311b2868f6c00e649f33a72166c2e5b
335335+ enable_longhorn = false
336336+337337+ # By default, longhorn is pulled from https://charts.longhorn.io.
338338+ # If you need a version of longhorn which assures compatibility with rancher you can set this variable to https://charts.rancher.io.
339339+ # longhorn_repository = "https://charts.rancher.io"
340340+341341+ # The namespace for longhorn deployment, default is "longhorn-system".
342342+ # longhorn_namespace = "longhorn-system"
343343+344344+ # The file system type for Longhorn, if enabled (ext4 is the default, otherwise you can choose xfs).
345345+ # longhorn_fstype = "xfs"
346346+347347+ # how many replica volumes should longhorn create (default is 3).
348348+ # longhorn_replica_count = 1
349349+350350+ # When you enable Longhorn, you can go with the default settings and just modify the above two variables OR you can add a longhorn_values variable
351351+ # with all needed helm values, see towards the end of the file in the advanced section. You can also use longhorn_merge_values.
352352+ # If that file is present, the system will use it during the deploy, if not it will use the default values with the two variable above that can be customized.
353353+ # After the cluster is deployed, you can always use HelmChartConfig definition to tweak the configuration.
354354+355355+ # Also, you can choose to use a Hetzner volume with Longhorn. By default, it will use the nodes own storage space, but if you add an attribute of
356356+ # longhorn_volume_size (⚠️ not a variable, just a possible agent nodepool attribute) with a value between 10 and 10240 GB to your agent nodepool definition, it will create and use the volume in question.
357357+ # See the agent nodepool section for an example of how to do that.
358358+359359+ # To disable Hetzner CSI storage, you can set the following to "true", default is "false".
360360+ # disable_hetzner_csi = true
361361+362362+ # If you want to use a specific Hetzner CCM and CSI version, set them below; otherwise, leave them as-is for the latest versions.
363363+ # See https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases for the available versions.
364364+ # hetzner_ccm_version = ""
365365+366366+ # By default, new installations use Helm to install Hetzner CCM. You can use the legacy deployment method (using `kubectl apply`) by setting `hetzner_ccm_use_helm = false`.
367367+ hetzner_ccm_use_helm = true
368368+369369+ # See https://github.com/hetznercloud/csi-driver/releases for the available versions.
370370+ # hetzner_csi_version = ""
371371+372372+ # If you want to specify the Kured version, set it below - otherwise it'll use the latest version available.
373373+ # See https://github.com/kubereboot/kured/releases for the available versions.
374374+ # kured_version = ""
375375+376376+ # Default is "traefik".
377377+ # If you want to enable the Nginx (https://kubernetes.github.io/ingress-nginx/) or HAProxy ingress controller instead of Traefik, you can set this to "nginx" or "haproxy".
378378+ # By the default we load optimal Traefik, Nginx or HAProxy ingress controller config for Hetzner, however you may need to tweak it to your needs, so to do,
379379+ # we allow you to add a traefik_values, nginx_values or haproxy_values, see towards the end of this file in the advanced section.
380380+ # You can also use *_merge_values to overlay defaults (or the *_values file if set).
381381+ # After the cluster is deployed, you can always use HelmChartConfig definition to tweak the configuration.
382382+ # If you want to disable both controllers set this to "none"
383383+ # ingress_controller = "nginx"
384384+ # Namespace in which to deploy the ingress controllers. Defaults to the ingress_controller variable, eg (haproxy, nginx, traefik)
385385+ # ingress_target_namespace = ""
386386+387387+ # You can change the number of replicas for selected ingress controller here. The default 0 means autoselecting based on number of agent nodes (1 node = 1 replica, 2 nodes = 2 replicas, 3+ nodes = 3 replicas)
388388+ ingress_replica_count = 1
389389+390390+ # Use the klipperLB (similar to metalLB), instead of the default Hetzner one, that has an advantage of dropping the cost of the setup.
391391+ # Automatically "true" in the case of single node cluster (as it does not make sense to use the Hetzner LB in that situation).
392392+ # It can work with any ingress controller that you choose to deploy.
393393+ # Please note that because the klipperLB points to all nodes, we automatically allow scheduling on the control plane when it is active.
394394+ # enable_klipper_metal_lb = "true"
395395+396396+ # If you want to configure additional arguments for traefik, enter them here as a list and in the form of traefik CLI arguments; see https://doc.traefik.io/traefik/reference/static-configuration/cli/
397397+ # They are the options that go into the additionalArguments section of the Traefik helm values file.
398398+ # We already add "providers.kubernetesingress.ingressendpoint.publishedservice" by default so that Traefik works automatically with services such as External-DNS and ArgoCD.
399399+ # Example:
400400+ # traefik_additional_options = ["--log.level=DEBUG", "--tracing=true"]
401401+402402+ # By default traefik image tag is an empty string which uses latest image tag.
403403+ # The default is "".
404404+ # traefik_image_tag = "v3.0.0-beta5"
405405+406406+ # By default traefik is configured to redirect http traffic to https, you can set this to "false" to disable the redirection.
407407+ # The default is true.
408408+ # traefik_redirect_to_https = false
409409+410410+ # Enable or disable Horizontal Pod Autoscaler for traefik.
411411+ # The default is true.
412412+ # traefik_autoscaling = false
413413+414414+ # Enable or disable pod disruption budget for traefik. Values are maxUnavailable: 33% and minAvailable: 1.
415415+ # The default is true.
416416+ # traefik_pod_disruption_budget = false
417417+418418+ # Enable kubernetes gateway api (https://doc.traefik.io/traefik/providers/kubernetes-gateway/) provider support.
419419+ # The default is false.
420420+ # traefik_provider_kubernetes_gateway_enabled = true
421421+422422+ # Enable or disable default resource requests and limits for traefik. Values requested are 100m & 50Mi and limits 300m & 150Mi.
423423+ # The default is true.
424424+ # traefik_resource_limits = false
425425+426426+ # If you want to configure additional ports for traefik, enter them here as a list of objects with name, port, and exposedPort properties.
427427+ # Example:
428428+ # traefik_additional_ports = [{name = "example", port = 1234, exposedPort = 1234}]
429429+430430+ # If you want to configure additional trusted IPs for traefik, enter them here as a list of IPs (strings).
431431+ # Example for Cloudflare:
432432+ # traefik_additional_trusted_ips = [
433433+ # "173.245.48.0/20",
434434+ # "103.21.244.0/22",
435435+ # "103.22.200.0/22",
436436+ # "103.31.4.0/22",
437437+ # "141.101.64.0/18",
438438+ # "108.162.192.0/18",
439439+ # "190.93.240.0/20",
440440+ # "188.114.96.0/20",
441441+ # "197.234.240.0/22",
442442+ # "198.41.128.0/17",
443443+ # "162.158.0.0/15",
444444+ # "104.16.0.0/13",
445445+ # "104.24.0.0/14",
446446+ # "172.64.0.0/13",
447447+ # "131.0.72.0/22",
448448+ # "2400:cb00::/32",
449449+ # "2606:4700::/32",
450450+ # "2803:f800::/32",
451451+ # "2405:b500::/32",
452452+ # "2405:8100::/32",
453453+ # "2a06:98c0::/29",
454454+ # "2c0f:f248::/32"
455455+ # ]
456456+457457+ # If you want to disable the metric server set this to "false". Default is "true".
458458+ # enable_metrics_server = false
459459+460460+ # If you want to enable the k3s built-in local-storage controller set this to "true". Default is "false".
461461+ # Warning: When enabled together with the Hetzner CSI, there will be two default storage classes: "local-path" and "hcloud-volumes"!
462462+ # Even if patched to remove the "default" label, the local-path storage class will be reset as default on each reboot of
463463+ # the node where the controller runs.
464464+ # This is not a problem if you explicitly define which storageclass to use in your PVCs.
465465+ # Workaround if you don't want two default storage classes: leave this to false and add the local-path-provisioner helm chart
466466+ # as an extra (https://github.com/kube-hetzner/terraform-hcloud-kube-hetzner#adding-extras).
467467+ # enable_local_storage = false
468468+469469+ allow_scheduling_on_control_plane = true
470470+471471+ # If you use both the Terraform-managed ingress LB AND CCM-managed LoadBalancer services, agents get registered to both.
472472+ # Enable this to exclude agents from CCM LBs (adds node.kubernetes.io/exclude-from-external-load-balancers=true label).
473473+ # WARNING: If allow_scheduling_on_control_plane=false, this leaves NO eligible targets for CCM LoadBalancer services.
474474+ # exclude_agents_from_external_load_balancers = true
475475+476476+ # If you want to disable the automatic upgrade of k3s, you can set below to "false".
477477+ # Ideally, keep it on, to always have the latest Kubernetes version, but lock the initial_k3s_channel to a kube major version,
478478+ # of your choice, like v1.25 or v1.26. That way you get the best of both worlds without the breaking changes risk.
479479+ # For production use, always use an HA setup with at least 3 control-plane nodes and 2 agents, and keep this on for maximum security.
480480+481481+ automatically_upgrade_k3s = true
482482+483483+ # By default nodes are drained before k3s upgrade, which will delete and transfer all pods to other nodes.
484484+ # Set this to false to cordon nodes instead, which just prevents scheduling new pods on the node during upgrade
485485+ # and keeps all pods running. This may be useful if you have pods which are known to be slow to start e.g.
486486+ # because they have to mount volumes with many files which require to get the right security context applied.
487487+ system_upgrade_use_drain = true
488488+489489+ # During k3s via system-upgrade-manager pods are evicted by default.
490490+ # On small clusters this can lead to hanging upgrades and indefinitely unschedulable nodes,
491491+ # in that case, set this to false to immediately delete pods before upgrading.
492492+ # NOTE: Turning this flag off might lead to downtimes of services (which may be acceptable for your use case)
493493+ # NOTE: This flag takes effect only when system_upgrade_use_drain is set to true.
494494+ # system_upgrade_enable_eviction = false
495495+496496+ automatically_upgrade_os = true
497497+498498+ # If you need more control over kured and the reboot behaviour, you can pass additional options to kured.
499499+ # For example limiting reboots to certain timeframes. For all options see: https://kured.dev/docs/configuration/
500500+ # By default, the kured lock does not expire and is only released once a node successfully reboots. You can add the option
501501+ # "lock-ttl" : "30m", if you have a single node which sometimes gets stuck. Note however, that in that case, kured continuous
502502+ # draining the next node because the lock was released. You may end up with all nodes drained and your cluster completely down.
503503+ # The default options are: `--reboot-command=/usr/bin/systemctl reboot --pre-reboot-node-labels=kured=rebooting --post-reboot-node-labels=kured=done --period=5m`
504504+ # Defaults can be overridden by using the same key.
505505+ # kured_options = {
506506+ # "reboot-days": "su",
507507+ # "start-time": "3am",
508508+ # "end-time": "8am",
509509+ # "time-zone": "Local",
510510+ # "lock-ttl" : "30m",
511511+ # }
512512+513513+ # Allows you to specify the k3s version. If defined, supersedes initial_k3s_channel.
514514+ # See https://github.com/k3s-io/k3s/releases for the available versions.
515515+ # install_k3s_version = "v1.30.2+k3s2"
516516+517517+ # Allows you to specify either stable, latest, testing or supported minor versions.
518518+ # see https://rancher.com/docs/k3s/latest/en/upgrades/basic/ and https://update.k3s.io/v1-release/channels
519519+ # ⚠️ If you are going to use Rancher addons for instance, it's always a good idea to fix the kube version to one minor version below the latest stable,
520520+ # e.g. v1.29 instead of the stable v1.30.
521521+ # The default is "v1.30".
522522+ initial_k3s_channel = "v1.31"
523523+524524+ # Allows to specify the version of the System Upgrade Controller for automated upgrades of k3s
525525+ # See https://github.com/rancher/system-upgrade-controller/releases for the available versions.
526526+ # sys_upgrade_controller_version = "v0.14.2"
527527+528528+ # The cluster name, by default "k3s"
529529+ # cluster_name = ""
530530+531531+ # Whether to use the cluster name in the node name, in the form of {cluster_name}-{nodepool_name}, the default is "true".
532532+ # use_cluster_name_in_node_name = false
533533+534534+ # Extra k3s registries. This is useful if you have private registries and you want to pull images without additional secrets.
535535+ # Or if you want to proxy registries for various reasons like rate-limiting.
536536+ # It will create the registries.yaml file, more info here https://docs.k3s.io/installation/private-registry.
537537+ # Note that you do not need to get this right from the first time, you can update it when you want during the life of your cluster.
538538+ # The default is blank.
539539+ /* k3s_registries = <<-EOT
540540+ mirrors:
541541+ hub.my_registry.com:
542542+ endpoint:
543543+ - "hub.my_registry.com"
544544+ configs:
545545+ hub.my_registry.com:
546546+ auth:
547547+ username: username
548548+ password: password
549549+ EOT */
550550+551551+ # Additional environment variables for the host OS on which k3s runs. See for example https://docs.k3s.io/advanced#configuring-an-http-proxy .
552552+ # additional_k3s_environment = {
553553+ # "CONTAINERD_HTTP_PROXY" : "http://your.proxy:port",
554554+ # "CONTAINERD_HTTPS_PROXY" : "http://your.proxy:port",
555555+ # "NO_PROXY" : "127.0.0.0/8,10.0.0.0/8,",
556556+ # }
557557+558558+ # Additional commands to execute on the host OS before the k3s install, for example fetching and installing certs.
559559+ # preinstall_exec = [
560560+ # "curl https://somewhere.over.the.rainbow/ca.crt > /root/ca.crt",
561561+ # "trust anchor --store /root/ca.crt",
562562+ # ]
563563+564564+ # Structured authentication configuration. Multiple authentication providers support requires v1.30+ of
565565+ # kubernetes.
566566+ # https://kubernetes.io/docs/reference/access-authn-authz/authentication/#using-authentication-configuration
567567+ #
568568+ # authentication_config = <<-EOT
569569+ # apiVersion: apiserver.config.k8s.io/v1beta1
570570+ # kind: AuthenticationConfiguration
571571+ # jwt:
572572+ # - issuer:
573573+ # url: "https://token.actions.githubusercontent.com"
574574+ # audiences:
575575+ # - "https://github.com/octo-org"
576576+ # claimMappings:
577577+ # username:
578578+ # claim: sub
579579+ # prefix: "gh:"
580580+ # groups:
581581+ # claim: repository_owner
582582+ # prefix: "gh:"
583583+ # claimValidationRules:
584584+ # - claim: repository
585585+ # requiredValue: "octo-org/octo-repo"
586586+ # - claim: "repository_visibility"
587587+ # requiredValue: "public"
588588+ # - claim: "ref"
589589+ # requiredValue: "refs/heads/main"
590590+ # - claim: "ref_type"
591591+ # requiredValue: "branch"
592592+ # - issuer:
593593+ # url: "https://your.oidc.issuer"
594594+ # audiences:
595595+ # - "oidc_client_id"
596596+ # claimMappings:
597597+ # username:
598598+ # claim: oidc_username_claim
599599+ # prefix: "oidc:"
600600+ # groups:
601601+ # claim: oidc_groups_claim
602602+ # prefix: "oidc:"
603603+ # EOT
604604+605605+ # Set to true if util-linux breaks on the OS (temporary regression fixed in util-linux v2.41.1).
606606+ # k3s_prefer_bundled_bin = true
607607+608608+ # Additional flags to pass to the k3s server command (the control plane).
609609+ # k3s_exec_server_args = "--kube-apiserver-arg enable-admission-plugins=PodTolerationRestriction,PodNodeSelector"
610610+611611+ # Additional flags to pass to the k3s agent command (every agents nodes, including autoscaler nodepools).
612612+ # k3s_exec_agent_args = "--kubelet-arg kube-reserved=cpu=100m,memory=200Mi,ephemeral-storage=1Gi"
613613+614614+ # The vars below here passes it to the k3s config.yaml. This way it persist across reboots
615615+ # Make sure you set "feature-gates=NodeSwap=true" if want to use swap_size
616616+ # Note: CloudDualStackNodeIPs was removed in K8s 1.32 (always enabled now)
617617+ # see https://github.com/k3s-io/k3s/issues/8811#issuecomment-1856974516
618618+ # k3s_global_kubelet_args = ["kube-reserved=cpu=100m,ephemeral-storage=1Gi", "system-reserved=cpu=memory=200Mi", "image-gc-high-threshold=50", "image-gc-low-threshold=40"]
619619+ # k3s_control_plane_kubelet_args = []
620620+ # k3s_agent_kubelet_args = []
621621+ # k3s_autoscaler_kubelet_args = []
622622+623623+ # https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/
624624+ # k3s_kubelet_config = <<-EOT
625625+ # apiVersion: kubelet.config.k8s.io/v1beta1
626626+ # kind: KubeletConfiguration
627627+ # imageGCLowThresholdPercent: 40
628628+ # imageGCHighThresholdPercent: 50
629629+ # imageMaximumGCAge: 24h
630630+ # EOT
631631+632632+ # If you want to allow all outbound traffic you can set this to "false". Default is "true".
633633+ # restrict_outbound_traffic = false
634634+635635+ # Allow access to the Kube API from the specified networks. The default is ["0.0.0.0/0", "::/0"].
636636+ # Allowed values: null (disable Kube API rule entirely) or a list of allowed networks with CIDR notation.
637637+ # For maximum security, it's best to disable it completely by setting it to null. However, in that case, to get access to the kube api,
638638+ # you would have to connect to any control plane node via SSH, as you can run kubectl from within these.
639639+ # Please be advised that this setting has no effect on the load balancer when the use_control_plane_lb variable is set to true. This is
640640+ # because firewall rules cannot be applied to load balancers yet.
641641+ firewall_kube_api_source = ["5.132.113.114"]
642642+643643+ # Allow SSH access from the specified networks. Default: ["0.0.0.0/0", "::/0"]
644644+ # Allowed values: null (disable SSH rule entirely) or a list of allowed networks with CIDR notation.
645645+ # Ideally you would set your IP there. And if it changes after cluster deploy, you can always update this variable and apply again.
646646+ firewall_ssh_source = ["5.132.113.114"]
647647+648648+ # By default, SELinux is enabled in enforcing mode on all nodes. For container-specific SELinux issues,
649649+ # consider using the pre-installed 'udica' tool to create custom, targeted SELinux policies instead of
650650+ # disabling SELinux globally. See the "Fix SELinux issues with udica" example in the README for details.
651651+ # disable_selinux = false
652652+653653+ # Adding extra firewall rules, like opening a port
654654+ # More info on the format here https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/firewall
655655+ # extra_firewall_rules = [
656656+ # {
657657+ # description = "For Postgres"
658658+ # direction = "in"
659659+ # protocol = "tcp"
660660+ # port = "5432"
661661+ # source_ips = ["0.0.0.0/0", "::/0"]
662662+ # destination_ips = [] # Won't be used for this rule
663663+ # },
664664+ # {
665665+ # description = "To Allow ArgoCD access to resources via SSH"
666666+ # direction = "out"
667667+ # protocol = "tcp"
668668+ # port = "22"
669669+ # source_ips = [] # Won't be used for this rule
670670+ # destination_ips = ["0.0.0.0/0", "::/0"]
671671+ # }
672672+ # ]
673673+674674+ # If you want to configure a different CNI for k3s, use this flag
675675+ # possible values: flannel (Default), calico, and cilium
676676+ # As for Cilium, we allow infinite configurations via helm values, please check the CNI section of the readme over at https://github.com/kube-hetzner/terraform-hcloud-kube-hetzner/#cni.
677677+ # Also, see the cilium_values at towards the end of this file, in the advanced section (or use cilium_merge_values).
678678+ # ⚠️ Depending on your setup, sometimes you need your control-planes to have more than
679679+ # 2GB of RAM if you are going to use Cilium, otherwise the pods will not start.
680680+ # cni_plugin = "cilium"
681681+682682+ # You can choose the version of Cilium that you want. By default we keep the version up to date and configure Cilium with compatible settings according to the version.
683683+ # See https://github.com/cilium/cilium/releases for the available versions.
684684+ # cilium_version = "v1.14.0"
685685+686686+ # Set native-routing mode ("native") or tunneling mode ("tunnel"). Default: tunnel
687687+ # cilium_routing_mode = "native"
688688+689689+ # Used when Cilium is configured in native routing mode. The CNI assumes that the underlying network stack will forward packets to this destination without the need to apply SNAT. Default: value of "cluster_ipv4_cidr"
690690+ # cilium_ipv4_native_routing_cidr = "10.0.0.0/8"
691691+692692+ # Enables egress gateway to redirect and SNAT the traffic that leaves the cluster. Default: false
693693+ # cilium_egress_gateway_enabled = true
694694+695695+ # Enables Hubble Observability to collect and visualize network traffic. Default: false
696696+ # cilium_hubble_enabled = true
697697+698698+ # Configures the list of Hubble metrics to collect.
699699+ # cilium_hubble_metrics_enabled = [
700700+ # "policy:sourceContext=app|workload-name|pod|reserved-identity;destinationContext=app|workload-name|pod|dns|reserved-identity;labelsContext=source_namespace,destination_namespace"
701701+ # ]
702702+703703+ # You can choose the version of Calico that you want. By default, the latest is used.
704704+ # More info on available versions can be found at https://github.com/projectcalico/calico/releases
705705+ # Please note that if you are getting 403s from Github, it's also useful to set the version manually. However there is rarely a need for that!
706706+ # calico_version = "v3.27.2"
707707+708708+ # If you want to disable the k3s kube-proxy, use this flag. The default is "false".
709709+ # Ensure that your CNI is capable of handling all the functionalities typically covered by kube-proxy.
710710+ # disable_kube_proxy = true
711711+712712+ # If you want to disable the k3s default network policy controller, use this flag!
713713+ # Both Calico and Cilium cni_plugin values override this value to true automatically, the default is "false".
714714+ # disable_network_policy = true
715715+716716+ # If you want to disable the automatic use of placement group "spread". See https://docs.hetzner.com/cloud/placement-groups/overview/
717717+ # We advise to not touch that setting, unless you have a specific purpose.
718718+ # The default is "false", meaning it's enabled by default.
719719+ # placement_group_disable = true
720720+721721+ # By default, we allow ICMP ping in to the nodes, to check for liveness for instance. If you do not want to allow that, you can. Just set this flag to true (false by default).
722722+ # block_icmp_ping_in = true
723723+724724+ # You can enable cert-manager (installed by Helm behind the scenes) with the following flag, the default is "true".
725725+ # enable_cert_manager = false
726726+727727+ # IP Addresses to use for the DNS Servers, the defaults are the ones provided by Hetzner https://docs.hetzner.com/dns-console/dns/general/recursive-name-servers/.
728728+ # The number of different DNS servers is limited to 3 by Kubernetes itself.
729729+ # It's always a good idea to have at least 1 IPv4 and 1 IPv6 DNS server for robustness.
730730+ dns_servers = [
731731+ "1.1.1.1",
732732+ "8.8.8.8",
733733+ "2606:4700:4700::1111",
734734+ ]
735735+736736+ # When this is enabled, rather than the first node, all external traffic will be routed via a control-plane loadbalancer, allowing for high availability.
737737+ # The default is false.
738738+ use_control_plane_lb = false
739739+740740+ # When the above use_control_plane_lb is enabled, you can change the lb type for it, the default is "lb11".
741741+ # control_plane_lb_type = "lb21"
742742+743743+ # When the above use_control_plane_lb is enabled, you can change to disable the public interface for control plane load balancer, the default is true.
744744+ # control_plane_lb_enable_public_interface = false
745745+746746+ # Let's say you are not using the control plane LB solution above, and still want to have one hostname point to all your control-plane nodes.
747747+ # You could create multiple A records of to let's say cp.cluster.my.org pointing to all of your control-plane nodes ips.
748748+ # In which case, you need to define that hostname in the k3s TLS-SANs config to allow connection through it. It can be hostnames or IP addresses.
749749+ # additional_tls_sans = ["cp.cluster.my.org"]
750750+751751+ # If you create a hostname with multiple A records pointing to all of your
752752+ # control-plane nodes ips, you may want to use that hostname in the generated
753753+ # kubeconfig.
754754+ # kubeconfig_server_address = "cp.cluster.my.org"
755755+756756+ # lb_hostname Configuration:
757757+ #
758758+ # Purpose:
759759+ # The lb_hostname setting optimizes communication between services within the Kubernetes cluster
760760+ # when they use domain names instead of direct service names. By associating a domain name directly
761761+ # with the Hetzner Load Balancer, this setting can help reduce potential communication delays.
762762+ #
763763+ # Scenario:
764764+ # If Service B communicates with Service A using a domain (e.g., `a.mycluster.domain.com`) that points
765765+ # to an external Load Balancer, there can be a slowdown in communication.
766766+ #
767767+ # Guidance:
768768+ # - If your internal services use domain names pointing to an external LB, set lb_hostname to a domain
769769+ # like `mycluster.domain.com`.
770770+ # - Create an A record pointing `mycluster.domain.com` to your LB's IP.
771771+ # - Create a CNAME record for `a.mycluster.domain.com` (or xyz.com) pointing to `mycluster.domain.com`.
772772+ #
773773+ # Technical Note:
774774+ # This setting sets the `load-balancer.hetzner.cloud/hostname` in the Hetzner LB definition, suitable for
775775+ # HAProxy, Nginx and Traefik ingress controllers.
776776+ #
777777+ # Recommendation:
778778+ # This setting is optional. If services communicate using direct service names, you can leave this unset.
779779+ # For inter-namespace communication, use `.service_name` as per Kubernetes norms.
780780+ #
781781+ # Example:
782782+ # lb_hostname = "mycluster.domain.com"
783783+784784+ # You can enable Rancher (installed by Helm behind the scenes) with the following flag, the default is "false".
785785+ # ⚠️ Rancher often doesn't support the latest Kubernetes version. You will need to set initial_k3s_channel to a supported version.
786786+ # When Rancher is enabled, it automatically installs cert-manager too, and it uses rancher's own self-signed certificates.
787787+ # See for options https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster#3-choose-your-ssl-configuration
788788+ # The easiest thing is to leave everything as is (using the default rancher self-signed certificate) and put Cloudflare in front of it.
789789+ # As for the number of replicas, by default it is set to the number of control plane nodes.
790790+ # You can customized all of the above by adding a rancher_values variable see at the end of this file in the advanced section (or use rancher_merge_values).
791791+ # After the cluster is deployed, you can always use HelmChartConfig definition to tweak the configuration.
792792+ # IMPORTANT: Rancher's install is quite memory intensive, you will require at least 4GB if RAM, meaning cx23 server type (for your control plane).
793793+ # ALSO, in order for Rancher to successfully deploy, you have to set the "rancher_hostname".
794794+ # enable_rancher = true
795795+796796+ # If using Rancher you can set the Rancher hostname, it must be unique hostname even if you do not use it.
797797+ # If not pointing the DNS, you can just port-forward locally via kubectl to get access to the dashboard.
798798+ # If you already set the lb_hostname above and are using a Hetzner LB, you do not need to set this one, as it will be used by default.
799799+ # But if you set this one explicitly, it will have preference over the lb_hostname in rancher settings.
800800+ # rancher_hostname = "rancher.xyz.dev"
801801+802802+ # When Rancher is deployed, by default is uses the "latest" channel. But this can be customized.
803803+ # The allowed values are "stable" or "latest".
804804+ # rancher_install_channel = "stable"
805805+806806+ # Finally, you can specify a bootstrap-password for your rancher instance. Minimum 48 characters long!
807807+ # If you leave empty, one will be generated for you.
808808+ # (Can be used by another rancher2 provider to continue setup of rancher outside this module.)
809809+ # rancher_bootstrap_password = ""
810810+811811+ # Separate from the above Rancher config (only use one or the other). You can import this cluster directly on an
812812+ # an already active Rancher install. By clicking "import cluster" choosing "generic", giving it a name and pasting
813813+ # the cluster registration url below. However, you can also ignore that and apply the url via kubectl as instructed
814814+ # by Rancher in the wizard, and that would register your cluster too.
815815+ # More information about the registration can be found here https://rancher.com/docs/rancher/v2.6/en/cluster-provisioning/registered-clusters/
816816+ # rancher_registration_manifest_url = "https://rancher.xyz.dev/v3/import/xxxxxxxxxxxxxxxxxxYYYYYYYYYYYYYYYYYYYzzzzzzzzzzzzzzzzzzzzz.yaml"
817817+818818+ # Extra commands to be executed after the `kubectl apply -k` (useful for post-install actions, e.g. wait for CRD, apply additional manifests, etc.).
819819+ # extra_kustomize_deployment_commands=""
820820+821821+ # Extra values that will be passed to the `extra-manifests/kustomization.yaml.tpl` if its present.
822822+ # extra_kustomize_parameters={}
823823+824824+ # See working examples for extra manifests or a HelmChart in examples/kustomization_user_deploy/README.md
825825+826826+ # It is best practice to turn this off, but for backwards compatibility it is set to "true" by default.
827827+ # See https://github.com/kube-hetzner/terraform-hcloud-kube-hetzner/issues/349
828828+ # When "false". The kubeconfig file can instead be created by executing: "terraform output --raw kubeconfig > cluster_kubeconfig.yaml"
829829+ # Always be careful to not commit this file!
830830+ create_kubeconfig = false
831831+832832+ # Don't create the kustomize backup. This can be helpful for automation.
833833+ # create_kustomization = false
834834+835835+ # Export the values.yaml files used for the deployment of traefik, longhorn, cert-manager, etc.
836836+ # This can be helpful to use them for later deployments like with ArgoCD.
837837+ # The default is false.
838838+ # export_values = true
839839+840840+ # MicroOS snapshot IDs to be used. Per default empty, the most recent image created using createkh will be used.
841841+ # We recommend the default, but if you want to use specific IDs you can.
842842+ # You can fetch the ids with the hcloud cli by running the "hcloud image list --selector 'microos-snapshot=yes'" command.
843843+ # microos_x86_snapshot_id = "1234567"
844844+ # microos_arm_snapshot_id = "1234567"
845845+846846+ ### ADVANCED - Custom helm values for packages above (search _values if you want to located where those are mentioned upper in this file)
847847+ # ⚠️ Inside the _values variable below are examples, up to you to find out the best helm values possible, we do not provide support for customized helm values.
848848+ # Please understand that the indentation is very important, inside the EOTs, as those are proper yaml helm values.
849849+ # We advise you to use the default values, and only change them if you know what you are doing!
850850+851851+ # You can inline the values here in heredoc-style (as the examples below with the <<EOT to EOT). Please note that the current indentation inside the EOT is important.
852852+ # Or you can create a thepackage-values.yaml file with the content and use it here with the following syntax:
853853+ # thepackage_values = file("thepackage-values.yaml")
854854+ # _values fully replaces the chart values used by the module. _merge_values keeps the defaults (or *_values if set) and overlays your YAML on top.
855855+856856+ # Cilium, all Cilium helm values can be found at https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/values.yaml
857857+ # Be careful when maintaining your own cilium_values, as the choice of available settings depends on the Cilium version used. See also the cilium_version setting to fix a specific version.
858858+ # If you want to merge extra values into defaults (or cilium_values), use cilium_merge_values.
859859+ # The following is an example, please note that the current indentation inside the EOT is important.
860860+ /* cilium_values = <<EOT
861861+862862+ipam:
863863+ mode: kubernetes
864864+k8s:
865865+ requireIPv4PodCIDR: true
866866+kubeProxyReplacement: true
867867+routingMode: native
868868+ipv4NativeRoutingCIDR: "10.0.0.0/8"
869869+endpointRoutes:
870870+ enabled: true
871871+loadBalancer:
872872+ acceleration: native
873873+bpf:
874874+ masquerade: true
875875+encryption:
876876+ enabled: true
877877+ type: wireguard
878878+MTU: 1450
879879+ EOT */
880880+881881+ /* cilium_merge_values = <<EOT
882882+encryption:
883883+ enabled: true
884884+ type: wireguard
885885+ EOT */
886886+887887+ # If you want to use a specific cert-manager helm chart version, set it below; otherwise, leave them as-is for the latest versions.
888888+ # cert_manager_version = ""
889889+890890+ # Cert manager, all cert-manager helm values can be found at https://github.com/cert-manager/cert-manager/blob/master/deploy/charts/cert-manager/values.yaml
891891+ # If you want to merge extra values into defaults (or cert_manager_values), use cert_manager_merge_values.
892892+ # The following is an example, please note that the current indentation inside the EOT is important.
893893+ # For cert-manager versions < v1.15.0, you need to set installCRDs: true instead of crds.enabled and crds.keep.
894894+ /* cert_manager_values = <<EOT
895895+crds:
896896+ enabled: true
897897+ keep: true
898898+replicaCount: 3
899899+webhook:
900900+ replicaCount: 3
901901+cainjector:
902902+ replicaCount: 3
903903+ EOT */
904904+905905+ /* cert_manager_merge_values = <<EOT
906906+webhook:
907907+ replicaCount: 2
908908+ EOT */
909909+910910+ # Hetzner Cloud Controller Manager, all Hetzner Cloud Controller Manager helm values can be found at https://github.com/hetznercloud/hcloud-cloud-controller-manager/blob/main/chart/values.yaml
911911+ # We advise you to not touch this and to let the defaults that are already set under the hood.
912912+ # If you want to merge extra values into defaults (or hetzner_ccm_values), use hetzner_ccm_merge_values.
913913+ # For advanced use cases like adding Hetzner Robot servers, see: https://github.com/kube-hetzner/terraform-hcloud-kube-hetzner/blob/master/docs/add-robot-server.md
914914+ # The following is an example, please note that the current indentation inside the EOT is important.
915915+ /* hetzner_ccm_values = <<EOT
916916+networking:
917917+ enabled: true
918918+args:
919919+ cloud-provider: hcloud
920920+ allow-untagged-cloud: ""
921921+ route-reconciliation-period: 30s
922922+ webhook-secure-port: "0"
923923+env:
924924+ HCLOUD_LOAD_BALANCERS_LOCATION:
925925+ value: "nbg1"
926926+ HCLOUD_LOAD_BALANCERS_USE_PRIVATE_IP:
927927+ value: "true"
928928+ HCLOUD_LOAD_BALANCERS_ENABLED:
929929+ value: "true"
930930+ HCLOUD_LOAD_BALANCERS_DISABLE_PRIVATE_INGRESS:
931931+ value: "true"
932932+ EOT */
933933+934934+ /* hetzner_ccm_merge_values = <<EOT
935935+env:
936936+ HCLOUD_LOAD_BALANCERS_LOCATION:
937937+ value: "nbg1"
938938+ EOT */
939939+940940+ # csi-driver-smb, all csi-driver-smb helm values can be found at https://github.com/kubernetes-csi/csi-driver-smb/blob/master/charts/latest/csi-driver-smb/values.yaml
941941+ # The following is an example, please note that the current indentation inside the EOT is important.
942942+ /* csi_driver_smb_values = <<EOT
943943+controller:
944944+ name: csi-smb-controller
945945+ replicas: 1
946946+ runOnMaster: false
947947+ runOnControlPlane: false
948948+ resources:
949949+ csiProvisioner:
950950+ limits:
951951+ memory: 300Mi
952952+ requests:
953953+ cpu: 10m
954954+ memory: 20Mi
955955+ livenessProbe:
956956+ limits:
957957+ memory: 100Mi
958958+ requests:
959959+ cpu: 10m
960960+ memory: 20Mi
961961+ smb:
962962+ limits:
963963+ memory: 200Mi
964964+ requests:
965965+ cpu: 10m
966966+ memory: 20Mi
967967+ EOT */
968968+969969+ # Longhorn, all Longhorn helm values can be found at https://github.com/longhorn/longhorn/blob/master/chart/values.yaml
970970+ # If you want to merge extra values into defaults (or longhorn_values), use longhorn_merge_values.
971971+ # The following is an example, please note that the current indentation inside the EOT is important.
972972+ /* longhorn_values = <<EOT
973973+defaultSettings:
974974+ defaultDataPath: /var/longhorn
975975+persistence:
976976+ defaultFsType: ext4
977977+ defaultClassReplicaCount: 3
978978+ defaultClass: true
979979+ EOT */
980980+981981+ /* longhorn_merge_values = <<EOT
982982+defaultSettings:
983983+ defaultReplicaCount: 2
984984+ EOT */
985985+986986+ # If you want to use a specific Traefik helm chart version, set it below; otherwise, leave them as-is for the latest versions.
987987+ # See https://github.com/traefik/traefik-helm-chart/releases for the available versions.
988988+ # traefik_version = ""
989989+990990+ # Traefik, all Traefik helm values can be found at https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
991991+ # If you want to merge extra values into defaults (or traefik_values), use traefik_merge_values.
992992+ # The following is an example, please note that the current indentation inside the EOT is important.
993993+ /* traefik_values = <<EOT
994994+deployment:
995995+ replicas: 1
996996+globalArguments: []
997997+service:
998998+ enabled: true
999999+ type: LoadBalancer
10001000+ annotations:
10011001+ "load-balancer.hetzner.cloud/name": "k3s"
10021002+ "load-balancer.hetzner.cloud/use-private-ip": "true"
10031003+ "load-balancer.hetzner.cloud/disable-private-ingress": "true"
10041004+ "load-balancer.hetzner.cloud/location": "nbg1"
10051005+ "load-balancer.hetzner.cloud/type": "lb11"
10061006+ "load-balancer.hetzner.cloud/uses-proxyprotocol": "true"
10071007+10081008+ports:
10091009+ web:
10101010+ redirections:
10111011+ entryPoint:
10121012+ to: websecure
10131013+ scheme: https
10141014+ permanent: true
10151015+10161016+ proxyProtocol:
10171017+ trustedIPs:
10181018+ - 127.0.0.1/32
10191019+ - 10.0.0.0/8
10201020+ forwardedHeaders:
10211021+ trustedIPs:
10221022+ - 127.0.0.1/32
10231023+ - 10.0.0.0/8
10241024+ websecure:
10251025+ proxyProtocol:
10261026+ trustedIPs:
10271027+ - 127.0.0.1/32
10281028+ - 10.0.0.0/8
10291029+ forwardedHeaders:
10301030+ trustedIPs:
10311031+ - 127.0.0.1/32
10321032+ - 10.0.0.0/8
10331033+ EOT */
10341034+10351035+ /* traefik_merge_values = <<EOT
10361036+service:
10371037+ annotations:
10381038+ "load-balancer.hetzner.cloud/location": "fsn1"
10391039+ EOT */
10401040+10411041+ # If you want to use a specific Nginx helm chart version, set it below; otherwise, leave them as-is for the latest versions.
10421042+ # See https://github.com/kubernetes/ingress-nginx?tab=readme-ov-file#supported-versions-table for the available versions.
10431043+ # nginx_version = ""
10441044+10451045+ # Nginx, all Nginx helm values can be found at https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml
10461046+ # You can also have a look at https://kubernetes.github.io/ingress-nginx/, to understand how it works, and all the options at your disposal.
10471047+ # If you want to merge extra values into defaults (or nginx_values), use nginx_merge_values.
10481048+ # The following is an example, please note that the current indentation inside the EOT is important.
10491049+ /* nginx_values = <<EOT
10501050+controller:
10511051+ watchIngressWithoutClass: "true"
10521052+ kind: "DaemonSet"
10531053+ config:
10541054+ "use-forwarded-headers": "true"
10551055+ "compute-full-forwarded-for": "true"
10561056+ "use-proxy-protocol": "true"
10571057+ service:
10581058+ annotations:
10591059+ "load-balancer.hetzner.cloud/name": "k3s"
10601060+ "load-balancer.hetzner.cloud/use-private-ip": "true"
10611061+ "load-balancer.hetzner.cloud/disable-private-ingress": "true"
10621062+ "load-balancer.hetzner.cloud/location": "nbg1"
10631063+ "load-balancer.hetzner.cloud/type": "lb11"
10641064+ "load-balancer.hetzner.cloud/uses-proxyprotocol": "true"
10651065+ EOT */
10661066+10671067+ /* nginx_merge_values = <<EOT
10681068+controller:
10691069+ kind: "Deployment"
10701070+ EOT */
10711071+10721072+ # If you want to use a specific HAProxy helm chart version, set it below; otherwise, leave them as-is for the latest versions.
10731073+ # haproxy_version = ""
10741074+10751075+ # If you want to configure additional proxy protocol trusted IPs for haproxy, enter them here as a list of IPs (strings).
10761076+ # Example for Cloudflare:
10771077+ # haproxy_additional_proxy_protocol_ips = [
10781078+ # "173.245.48.0/20",
10791079+ # "103.21.244.0/22",
10801080+ # "103.22.200.0/22",
10811081+ # "103.31.4.0/22",
10821082+ # "141.101.64.0/18",
10831083+ # "108.162.192.0/18",
10841084+ # "190.93.240.0/20",
10851085+ # "188.114.96.0/20",
10861086+ # "197.234.240.0/22",
10871087+ # "198.41.128.0/17",
10881088+ # "162.158.0.0/15",
10891089+ # "104.16.0.0/13",
10901090+ # "104.24.0.0/14",
10911091+ # "172.64.0.0/13",
10921092+ # "131.0.72.0/22",
10931093+ # "2400:cb00::/32",
10941094+ # "2606:4700::/32",
10951095+ # "2803:f800::/32",
10961096+ # "2405:b500::/32",
10971097+ # "2405:8100::/32",
10981098+ # "2a06:98c0::/29",
10991099+ # "2c0f:f248::/32"
11001100+ # ]
11011101+11021102+ # Configure CPU and memory requests for each HAProxy pod
11031103+ # haproxy_requests_cpu = "250m"
11041104+ # haproxy_requests_memory = "400Mi"
11051105+11061106+ # Override values given to the HAProxy helm chart.
11071107+ # All HAProxy helm values can be found at https://github.com/haproxytech/helm-charts/blob/main/kubernetes-ingress/values.yaml
11081108+ # Default values can be found at https://github.com/kube-hetzner/terraform-hcloud-kube-hetzner/blob/master/locals.tf
11091109+ # If you want to merge extra values into defaults (or haproxy_values), use haproxy_merge_values.
11101110+ /* haproxy_values = <<EOT
11111111+ EOT */
11121112+11131113+ /* haproxy_merge_values = <<EOT
11141114+controller:
11151115+ replicaCount: 2
11161116+ EOT */
11171117+11181118+ # Rancher, all Rancher helm values can be found at https://rancher.com/docs/rancher/v2.5/en/installation/install-rancher-on-k8s/chart-options/
11191119+ # If you want to merge extra values into defaults (or rancher_values), use rancher_merge_values.
11201120+ # The following is an example, please note that the current indentation inside the EOT is important.
11211121+ /* rancher_values = <<EOT
11221122+ingress:
11231123+ tls:
11241124+ source: "rancher"
11251125+hostname: "rancher.example.com"
11261126+replicas: 1
11271127+bootstrapPassword: "supermario"
11281128+ EOT */
11291129+11301130+ /* rancher_merge_values = <<EOT
11311131+replicas: 3
11321132+ EOT */
11331133+11341134+}
11351135+11361136+provider "hcloud" {
11371137+ token = var.hcloud_token != "" ? var.hcloud_token : local.hcloud_token
11381138+}
11391139+11401140+terraform {
11411141+ required_version = ">= 1.5.0"
11421142+ required_providers {
11431143+ hcloud = {
11441144+ source = "hetznercloud/hcloud"
11451145+ version = ">= 1.51.0"
11461146+ }
11471147+ }
11481148+}
11491149+11501150+output "kubeconfig" {
11511151+ value = module.kube-hetzner.kubeconfig
11521152+ sensitive = true
11531153+}
11541154+11551155+variable "hcloud_token" {
11561156+ sensitive = true
11571157+ default = ""
11581158+}