Skip to content

Commit 410eca5

Browse files
authored
Enhance Hetzner example for HA controlplane with LB (#108)
* Enhance Hetzner example for HA controlplane with LB Signed-off-by: Jussi Nummelin <[email protected]> * Bump k0s version to 0.12.0 Signed-off-by: Jussi Nummelin <[email protected]> * Bump k0s to 0.12.1 for all examples Signed-off-by: Jussi Nummelin <[email protected]>
1 parent f625177 commit 410eca5

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

examples/aws-tf/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ locals {
8383
}
8484
]
8585
k0s = {
86-
version = "0.10.0-beta2"
86+
version = "0.12.1"
8787
}
8888
}
8989
}

examples/footloose/k0sctl.yaml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ spec:
1111
address: 127.0.0.1
1212
port: 9023
1313
k0s:
14-
version: 0.11.0
14+
version: 0.12.1

examples/hetzner-tf/main.tf

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
terraform {
2+
required_providers {
3+
hcloud = {
4+
source = "hetznercloud/hcloud"
5+
version = "~> 1.24"
6+
}
7+
}
8+
}
19
variable "hcloud_token" {
210
description = "Hetzner API token"
311
}
@@ -67,6 +75,45 @@ resource "hcloud_server" "worker" {
6775
}
6876
}
6977

78+
resource "hcloud_load_balancer" "load_balancer" {
79+
name = "${var.cluster_name}-balancer"
80+
load_balancer_type = "lb11"
81+
location = var.location
82+
}
83+
84+
resource "hcloud_load_balancer_target" "load_balancer_target" {
85+
type = "label_selector"
86+
load_balancer_id = hcloud_load_balancer.load_balancer.id
87+
label_selector = "role=controller"
88+
}
89+
90+
resource "hcloud_load_balancer_service" "load_balancer_service_6443" {
91+
load_balancer_id = hcloud_load_balancer.load_balancer.id
92+
protocol = "tcp"
93+
listen_port = 6443
94+
destination_port = 6443
95+
}
96+
97+
resource "hcloud_load_balancer_service" "load_balancer_service_9443" {
98+
load_balancer_id = hcloud_load_balancer.load_balancer.id
99+
protocol = "tcp"
100+
listen_port = 9443
101+
destination_port = 9443
102+
}
103+
104+
resource "hcloud_load_balancer_service" "load_balancer_service_8132" {
105+
load_balancer_id = hcloud_load_balancer.load_balancer.id
106+
protocol = "tcp"
107+
listen_port = 8132
108+
destination_port = 8132
109+
}
110+
111+
resource "hcloud_load_balancer_service" "load_balancer_service_8133" {
112+
load_balancer_id = hcloud_load_balancer.load_balancer.id
113+
protocol = "tcp"
114+
listen_port = 8133
115+
destination_port = 8133
116+
}
70117
locals {
71118
k0s_tmpl = {
72119
apiVersion = "k0sctl.k0sproject.io/v1beta1"
@@ -82,7 +129,20 @@ locals {
82129
}
83130
]
84131
k0s = {
85-
version = "0.10.0-beta2"
132+
version = "0.12.1"
133+
"config" = {
134+
"apiVersion" = "k0s.k0sproject.io/v1beta1"
135+
"kind" = "Cluster"
136+
"metadata" = {
137+
"name" = var.cluster_name
138+
}
139+
"spec" = {
140+
"api" = {
141+
"externalAddress" = hcloud_load_balancer.load_balancer.ipv4
142+
"sans" = [hcloud_load_balancer.load_balancer.ipv4]
143+
}
144+
}
145+
}
86146
}
87147
}
88148
}

smoke-test/k0sctl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
port: 9023
1616
keyPath: ./id_rsa_k0s
1717
k0s:
18-
version: "0.12.1-rc.1"
18+
version: "0.12.1"
1919
config:
2020
images:
2121
konnectivity:

0 commit comments

Comments
 (0)