Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
resource "rancher2_cluster" "cluster-admin" {
name = "cluster-admin"
description = "cluster for admin tools (argocd, minio, ...)"
rke_config {
kubernetes_version = "v1.22.13-rancher1-1"
network {
plugin = "canal"
}
ingress {
provider = "none"
}
}
}
output "cluster-admin-config-summary" {
sensitive = true
value = rancher2_cluster.cluster-admin.kube_config
}
output "cluster-admin-register-command" {
sensitive = true
value = rancher2_cluster.cluster-admin.cluster_registration_token[0].node_command
}
module "rancher-node-admin-mgmt1" {
hostname = "rancher-node-admin-mgmt1"
vmid = 171
source = "../modules/node"
template = var.templates["stable-zfs"]
config = local.config
description = "Admin cluster node with etcd, controlplane and worker roles"
hypervisor = "hypervisor3"
sockets = "1"
cores = "4"
onboot = true
memory = "12288"
balloon = "8192"
networks = [{
id = 0
ip = "192.168.50.45"
gateway = local.config["gateway_ip"]
bridge = local.config["vlan"]
}]
storages = [{
storage = "proxmox"
size = "20G"
}, {
storage = "proxmox"
size = "20G"
}
]
post_provision_steps = [
"systemctl restart docker", # workaround
"${rancher2_cluster.cluster-admin.cluster_registration_token[0].node_command} --etcd --controlplane"
]
}
output "rancher-node-admin-mgmt1_summary" {
value = module.rancher-node-admin-mgmt1.summary
}
module "rancher-node-admin-node01" {
hostname = "rancher-node-admin-node01"
vmid = 172
source = "../modules/node"
template = var.templates["stable-zfs"]
config = local.config
description = "Admin cluster node01"
hypervisor = "hypervisor3"
sockets = "1"
cores = "4"
onboot = true
memory = "16384"
balloon = "8192"
networks = [{
id = 0
ip = "192.168.50.46"
gateway = local.config["gateway_ip"]
bridge = local.config["vlan"]
}]
storages = [{
storage = "proxmox"
size = "20G"
}, {
storage = "proxmox"
size = "20G"
}
]
post_provision_steps = [
"systemctl restart docker", # workaround
"${rancher2_cluster.cluster-admin.cluster_registration_token[0].node_command} --worker"
]
}
output "rancher-node-admin-node01_summary" {
value = module.rancher-node-admin-node01.summary
}
module "rancher-node-admin-node02" {
hostname = "rancher-node-admin-node02"
vmid = 173
source = "../modules/node"
template = var.templates["stable-zfs"]
config = local.config
description = "Admin cluster node02"
hypervisor = "branly"
sockets = "1"
cores = "4"
onboot = true
memory = "16384"
balloon = "8192"
networks = [{
id = 0
ip = "192.168.50.47"
gateway = local.config["gateway_ip"]
bridge = local.config["vlan"]
}]
storages = [{
storage = "proxmox"
size = "20G"
}, {
storage = "proxmox"
size = "20G"
}
]
post_provision_steps = [
"systemctl restart docker", # workaround
"${rancher2_cluster.cluster-admin.cluster_registration_token[0].node_command} --worker"
]
}
output "rancher-node-admin-node02_summary" {
value = module.rancher-node-admin-node02.summary
}
module "rancher-node-admin-node03" {
hostname = "rancher-node-admin-node03"
vmid = 174
source = "../modules/node"
template = var.templates["stable-zfs"]
config = local.config
description = "Admin cluster node03"
hypervisor = "pompidou"
sockets = "1"
cores = "4"
onboot = true
memory = "16384"
balloon = "8192"
networks = [{
id = 0
ip = "192.168.50.48"
gateway = local.config["gateway_ip"]
bridge = local.config["vlan"]
}]
storages = [{
storage = "proxmox"
size = "20G"
}, {
storage = "proxmox"
size = "20G"
}
]
post_provision_steps = [
"systemctl restart docker", # workaround
"${rancher2_cluster.cluster-admin.cluster_registration_token[0].node_command} --worker"
]
}
output "rancher-node-admin-node03_summary" {
value = module.rancher-node-admin-node03.summary
}
resource "rancher2_app_v2" "cluster-admin-rancher-monitoring" {
cluster_id = rancher2_cluster.cluster-admin.id
name = "rancher-monitoring"
namespace = "cattle-monitoring-system"
repo_name = "rancher-charts"
chart_name = "rancher-monitoring"
chart_version = "100.1.3+up19.0.3"
values = <<EOF
prometheus:
enabled: true
prometheusSpec:
requests:
cpu: 250m
memory: 250Mi
retention: 15d # Temporary until the sync to azure is in place
# mark metrics with discriminative information, check official doc for details
# see https://thanos.io/tip/thanos/quick-tutorial.md/#external-labels
externalLabels:
environment: admin
infrastructure: kubernetes
domain: admin
cluster_name: ${rancher2_cluster.cluster-admin.name}
thanos:
# thanos-objstore-config-secret is installed in namespace cattle-monitoring-system
# see k8s-private-data:admin/thanos-objstore-config-secret.yaml. And
# https://prometheus-operator.dev/docs/operator/thanos/#configuring-thanos-object-storage
objectStorageConfig:
key: thanos.yaml
name: thanos-objstore-config-secret
# thanos sidecar
thanosService:
enabled: false
thanosIngress:
enabled: true
hosts: ["k8s-admin-thanos.internal.softwareheritage.org"]
loadBalancerIP: 192.168.50.44
pathType: Prefix
annotations:
metallb.universe.tf/allow-shared-ip: clusterIP
nginx.ingress.kubernetes.io/backend-protocol: GRPC
thanosServiceMonitor:
enabled: false
thanosServiceExternal:
enabled: false
loadBalancerIP: 192.168.50.44
annotations:
metallb.universe.tf/allow-shared-ip: clusterIP
EOF
}