forked from vmware/cluster-api-provider-cloud-director
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster-template-v1.24.10-crs-ignition.yaml
356 lines (356 loc) · 15.7 KB
/
cluster-template-v1.24.10-crs-ignition.yaml
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${TARGET_NAMESPACE}
labels:
cni: antrea
ccm: external
csi: external
spec:
clusterNetwork:
pods:
cidrBlocks:
- ${POD_CIDR} # pod CIDR for the cluster
serviceDomain: cluster.local
services:
cidrBlocks:
- ${SERVICE_CIDR} # service CIDR for the clusterrdeId
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: ${CLUSTER_NAME}-control-plane # name of the KubeadmControlPlane object associated with the cluster.
namespace: ${TARGET_NAMESPACE} # kubernetes namespace in which the KubeadmControlPlane object reside. Should be the same namespace as that of the Cluster object
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: VCDCluster
name: ${CLUSTER_NAME} # name of the VCDCluster object associated with the cluster.
namespace: ${TARGET_NAMESPACE} # kubernetes namespace in which the VCDCluster object resides. Should be the same namespace as that of the Cluster object
---
apiVersion: v1
kind: Secret
metadata:
name: capi-user-credentials
namespace: ${TARGET_NAMESPACE}
type: Opaque
data:
username: "${VCD_USERNAME_B64}" # B64 encoded username of the VCD persona creating the cluster. If system administrator is the user, please encode 'system/administrator' as the username.
password: "${VCD_PASSWORD_B64}" # B64 encoded password associated with the user creating the cluster
refreshToken: "${VCD_REFRESH_TOKEN_B64}" # B64 encoded refresh token of the client registered with VCD for creating clusters. password can be left blank if refresh token is provided
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: VCDCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${TARGET_NAMESPACE}
spec:
site: ${VCD_SITE} # VCD endpoint with the format https://VCD_HOST. No trailing '/'
org: ${VCD_ORGANIZATION} # VCD organization name where the cluster should be deployed
ovdc: ${VCD_ORGANIZATION_VDC} # VCD virtual datacenter name where the cluster should be deployed
ovdcNetwork: ${VCD_ORGANIZATION_VDC_NETWORK} # VCD virtual datacenter network to be used by the cluster
useAsManagementCluster: false # intent to use the resultant CAPVCD cluster as a management cluster; defaults to false
userContext:
secretRef:
name: capi-user-credentials
namespace: ${TARGET_NAMESPACE}
loadBalancerConfigSpec:
vipSubnet: "" # Virtual IP CIDR for the external network
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: VCDMachineTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${TARGET_NAMESPACE}
spec:
template:
spec:
catalog: ${VCD_CATALOG} # Catalog hosting the TKGm template, which will be used to deploy the control plane VMs
template: ${VCD_TEMPLATE_NAME} # Name of the template to be used to create (or) upgrade the control plane nodes (this template must be pre-suploaded to the catalog in VCD)
sizingPolicy: ${VCD_CONTROL_PLANE_SIZING_POLICY} # Sizing policy to be used for the control plane VMs (this must be pre-published on the chosen organization virtual datacenter). If no sizing policy should be used, use "".
placementPolicy: ${VCD_CONTROL_PLANE_PLACEMENT_POLICY} # Placement policy to be used for worker VMs (this must be pre-published on the chosen organization virtual datacenter)
storageProfile: "${VCD_CONTROL_PLANE_STORAGE_PROFILE}" # Storage profile for control plane machine if any
diskSize: ${DISK_SIZE} # Disk size to use for the control plane machine, defaults to 20Gi
enableNvidiaGPU: false
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${TARGET_NAMESPACE}
spec:
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
certSANs:
- localhost
- 127.0.0.1
controllerManager:
extraArgs:
enable-hostpath-provisioner: "true"
dns:
imageRepository: coredns # image repository to pull the DNS image from
imageTag: 1.8.6
etcd:
local:
imageRepository: quay.io/coreos/etcd # image repository to pull the etcd image from
imageTag: v3.5.6
imageRepository: bitnami # image repository to use for the rest of kubernetes images
users:
- name: root
sshAuthorizedKeys:
- "${SSH_PUBLIC_KEY}" # ssh public key to log in to the control plane VMs in VCD
format: ignition
ignition:
containerLinuxConfig:
additionalConfig: |-
storage:
files:
- path: /opt/set-hostname
filesystem: root
mode: 0744
contents:
inline: |
#!/bin/sh
set -x
echo "${COREOS_CUSTOM_HOSTNAME}" > /etc/hostname
hostname "${COREOS_CUSTOM_HOSTNAME}"
echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
echo "127.0.0.1 localhost" >>/etc/hosts
echo "127.0.0.1 ${COREOS_CUSTOM_HOSTNAME}" >>/etc/hosts
systemd:
units:
- name: coreos-metadata.service
contents: |
[Unit]
Description=VMware metadata agent
After=nss-lookup.target
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
Restart=on-failure
RemainAfterExit=yes
Environment=OUTPUT=/run/metadata/coreos
ExecStart=/usr/bin/mkdir --parent /run/metadata
ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$(/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.ignition.vmname")" > ${OUTPUT}'
- name: set-hostname.service
enabled: true
contents: |
[Unit]
Description=Set the hostname
Requires=coreos-metadata.service
After=coreos-metadata.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/run/metadata/coreos
ExecStart=/opt/set-hostname
[Install]
WantedBy=multi-user.target
- name: set-networkd-units.service
enabled: true
contents: |
[Unit]
Description=Install the networkd unit files
Requires=coreos-metadata.service
After=set-hostname.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bash -cv 'echo "$(/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.ignition.network")" > /opt/set-networkd-units'
ExecStart=/usr/bin/bash -cv 'chmod u+x /opt/set-networkd-units'
ExecStart=/opt/set-networkd-units
[Install]
WantedBy=multi-user.target
- name: ethtool-segmentation.service
enabled: true
contents: |
[Unit]
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/ethtool -K ens192 tx-udp_tnl-csum-segmentation off
ExecStart=/usr/sbin/ethtool -K ens192 tx-udp_tnl-segmentation off
[Install]
WantedBy=default.target
- name: kubeadm.service
enabled: true
dropins:
- name: 10-flatcar.conf
contents: |
[Unit]
# kubeadm must run after coreos-metadata populated /run/metadata directory.
Requires=coreos-metadata.service
After=set-networkd-units.service
[Service]
# Make metadata environment variables available for pre-kubeadm commands.
EnvironmentFile=/run/metadata/*
initConfiguration:
nodeRegistration:
criSocket: /run/containerd/containerd.sock
kubeletExtraArgs:
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
cloud-provider: external
joinConfiguration:
nodeRegistration:
criSocket: /run/containerd/containerd.sock
kubeletExtraArgs:
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
cloud-provider: external
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: VCDMachineTemplate
name: ${CLUSTER_NAME}-control-plane # name of the VCDMachineTemplate object used to deploy control plane VMs. Should be the same name as that of KubeadmControlPlane object
namespace: ${TARGET_NAMESPACE} # kubernetes namespace of the VCDMachineTemplate object. Should be the same namespace as that of the Cluster object
replicas: ${CONTROL_PLANE_MACHINE_COUNT} # desired number of control plane nodes for the cluster
version: v1.24.10 # Kubernetes version to be used to create (or) upgrade the control plane nodes.
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: VCDMachineTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${TARGET_NAMESPACE}
spec:
template:
spec:
catalog: ${VCD_CATALOG} # Catalog hosting the TKGm template, which will be used to deploy the worker VMs
template: ${VCD_TEMPLATE_NAME} # Name of the template to be used to create (or) upgrade the control plane nodes (this template must be pre-suploaded to the catalog in VCD)
sizingPolicy: ${VCD_WORKER_SIZING_POLICY} # Sizing policy to be used for the worker VMs (this must be pre-published on the chosen organization virtual datacenter). If no sizing policy should be used, use "".
placementPolicy: ${VCD_WORKER_PLACEMENT_POLICY} # Placement policy to be used for worker VMs (this must be pre-published on the chosen organization virtual datacenter)
storageProfile: "${VCD_WORKER_STORAGE_PROFILE}" # Storage profile for control plane machine if any
diskSize: ${DISK_SIZE} # Disk size for the worker machine; defaults to 20Gi
enableNvidiaGPU: false
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${TARGET_NAMESPACE}
spec:
template:
spec:
users:
- name: root
sshAuthorizedKeys:
- "${SSH_PUBLIC_KEY}" # ssh public key to log in to the worker VMs in VCD
joinConfiguration:
nodeRegistration:
criSocket: /run/containerd/containerd.sock
kubeletExtraArgs:
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
cloud-provider: external
format: ignition
ignition:
containerLinuxConfig:
additionalConfig: |-
storage:
files:
- path: /opt/set-hostname
filesystem: root
mode: 0744
contents:
inline: |
#!/bin/sh
set -x
echo "${COREOS_CUSTOM_HOSTNAME}" > /etc/hostname
hostname "${COREOS_CUSTOM_HOSTNAME}"
echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
echo "127.0.0.1 localhost" >>/etc/hosts
echo "127.0.0.1 ${COREOS_CUSTOM_HOSTNAME}" >>/etc/hosts
systemd:
units:
- name: coreos-metadata.service
contents: |
[Unit]
Description=VMware metadata agent
After=nss-lookup.target
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
Restart=on-failure
RemainAfterExit=yes
Environment=OUTPUT=/run/metadata/coreos
ExecStart=/usr/bin/mkdir --parent /run/metadata
ExecStart=/usr/bin/bash -cv 'echo "COREOS_CUSTOM_HOSTNAME=$(/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.ignition.vmname")" > ${OUTPUT}'
- name: set-hostname.service
enabled: true
contents: |
[Unit]
Description=Set the hostname
Requires=coreos-metadata.service
After=coreos-metadata.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/run/metadata/coreos
ExecStart=/opt/set-hostname
[Install]
WantedBy=multi-user.target
- name: set-networkd-units.service
enabled: true
contents: |
[Unit]
Description=Install the networkd unit files
Requires=coreos-metadata.service
After=set-hostname.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bash -cv 'echo "$(/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.ignition.network")" > /opt/set-networkd-units'
ExecStart=/usr/bin/bash -cv 'chmod u+x /opt/set-networkd-units'
ExecStart=/opt/set-networkd-units
[Install]
WantedBy=multi-user.target
- name: ethtool-segmentation.service
enabled: true
contents: |
[Unit]
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/ethtool -K ens192 tx-udp_tnl-csum-segmentation off
ExecStart=/usr/sbin/ethtool -K ens192 tx-udp_tnl-segmentation off
[Install]
WantedBy=default.target
- name: kubeadm.service
enabled: true
dropins:
- name: 10-flatcar.conf
contents: |
[Unit]
# kubeadm must run after coreos-metadata populated /run/metadata directory.
Requires=coreos-metadata.service
After=set-networkd-units.service
[Service]
# Make metadata environment variables available for pre-kubeadm commands.
EnvironmentFile=/run/metadata/*
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${TARGET_NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME} # name of the Cluster object
replicas: ${WORKER_MACHINE_COUNT} # desired number of worker nodes for the cluster
selector:
matchLabels: null
template:
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: ${CLUSTER_NAME}-md-0 # name of the KubeadmConfigTemplate object
namespace: ${TARGET_NAMESPACE} # kubernetes namespace of the KubeadmConfigTemplate object. Should be the same namespace as that of the Cluster object
clusterName: ${CLUSTER_NAME} # name of the Cluster object
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: VCDMachineTemplate
name: ${CLUSTER_NAME}-md-0 # name of the VCDMachineTemplate object used to deploy worker nodes
namespace: ${TARGET_NAMESPACE} # kubernetes namespace of the VCDMachineTemplate object used to deploy worker nodes
version: v1.24.10 # Kubernetes version to be used to create (or) upgrade the worker nodes.