Newer
Older
resource "rancher2_cluster" "cluster-admin" {
name = "cluster-admin"
description = "cluster for admin tools (argocd, minio, ...)"
rke_config {
kubernetes_version = "v1.26.7-rancher1-1"
enable_cri_dockerd = true
network {
plugin = "canal"
}
ingress {
default_backend = false
upgrade_strategy {
drain = true
drain_input {
delete_local_data = true
timeout = 300
}
}
}
}
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["bridge"]
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
}]
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["bridge"]
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
}]
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["bridge"]
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
}]
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 = "mucem"
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["bridge"]
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
}]
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 = "102.0.1+up40.1.2"
alertmanager:
alertmanagerSpec:
logLevel: debug
global:
cattle:
clusterId: c-q2wd4
clusterName: cluster-admin
systemDefaultRegistry: ""
systemDefaultRegistry: ""
Vincent Sellier
committed
nodeExporter:
serviceMonitor:
enabled: true
relabelings:
- action: replace
regex: ^(.*)$
replacement: $1
sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: instance
prometheus:
enabled: true
prometheusSpec:
externalLabels:
cluster: ${rancher2_cluster.cluster-admin.name}
Vincent Sellier
committed
domain: admin
environment: admin
infrastructure: kubernetes
Vincent Sellier
committed
resources:
limits:
cpu: 1500m
retention: 15d
thanos:
objectStorageConfig:
key: thanos.yaml
name: thanos-objstore-config-secret
thanosIngress:
annotations:
Vincent Sellier
committed
cert-manager.io/cluster-issuer: letsencrypt-production
kubernetes.io/tls-acme: "true"
metallb.universe.tf/allow-shared-ip: clusterIP
nginx.ingress.kubernetes.io/backend-protocol: GRPC
Vincent Sellier
committed
enabled: true
hosts:
- k8s-admin-thanos.internal.admin.swh.network
loadBalancerIP: 192.168.50.44
pathType: Prefix
tls:
- hosts:
- k8s-admin-thanos.internal.admin.swh.network
secretName: thanos-crt
thanosService:
enabled: false
thanosServiceExternal:
annotations:
metallb.universe.tf/allow-shared-ip: clusterIP
Vincent Sellier
committed
enabled: false
loadBalancerIP: 192.168.50.44
prometheusOperator:
logLevel: debug
depends_on = [rancher2_cluster_sync.cluster-admin,
rancher2_cluster.cluster-admin,
module.rancher-node-admin-mgmt1,
module.rancher-node-admin-node01,
module.rancher-node-admin-node02,
module.rancher-node-admin-node03]
}
resource "rancher2_cluster_sync" "cluster-admin" {
cluster_id = rancher2_cluster.cluster-admin.id
state_confirm = 2
timeouts {
create = "45m"
}