-
Notifications
You must be signed in to change notification settings - Fork 84
/
cluster-template-vpc-clusterclass.yaml
421 lines (421 loc) · 10.9 KB
/
cluster-template-vpc-clusterclass.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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
labels:
ccm: external
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
spec:
clusterNetwork:
pods:
cidrBlocks:
- ${POD_CIDR:="192.168.0.0/16"}
serviceDomain: ${SERVICE_DOMAIN:="cluster.local"}
services:
cidrBlocks:
- ${SERVICE_CIDR:="10.128.0.0/12"}
topology:
class: ${IBMVPC_CLUSTER_CLASS_NAME}
controlPlane:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
version: ${KUBERNETES_VERSION}
workers:
machineDeployments:
- class: default-worker
name: md-0
replicas: ${WORKER_MACHINE_COUNT}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: ${IBMVPC_CLUSTER_CLASS_NAME:="vpc-cc"}
spec:
controlPlane:
machineInfrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCMachineTemplate
name: ${IBMVPC_CLUSTER_CLASS_NAME}-control-plane-machinetemplate
namespace: ${NAMESPACE}
ref:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
name: ${IBMVPC_CLUSTER_CLASS_NAME}-control-plane
namespace: ${NAMESPACE}
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCClusterTemplate
name: ${IBMVPC_CLUSTER_CLASS_NAME}-cluster-template
namespace: ${NAMESPACE}
workers:
machineDeployments:
- class: default-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: ${IBMVPC_CLUSTER_CLASS_NAME}-md-0
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCMachineTemplate
name: ${IBMVPC_CLUSTER_CLASS_NAME}-worker-machinetemplate
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCClusterTemplate
metadata:
name: ${IBMVPC_CLUSTER_CLASS_NAME}-cluster-template
spec:
template:
spec:
controlPlaneLoadBalancer:
name: ${CLUSTER_NAME}-load-balancer
region: ${IBMVPC_REGION}
resourceGroup: ${IBMVPC_RESOURCEGROUP}
vpc: ${IBMVPC_NAME}
zone: ${IBMVPC_ZONE}
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
metadata:
name: ${IBMVPC_CLUSTER_CLASS_NAME}-control-plane
namespace: ${NAMESPACE}
spec:
template:
spec:
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
certSANs:
- localhost
- 127.0.0.1
extraArgs:
cloud-provider: external
controllerManager:
extraArgs:
cloud-provider: external
enable-hostpath-provisioner: "true"
dns: {}
etcd: {}
kubernetesVersion: ${KUBERNETES_VERSION}
networking: {}
scheduler: {}
initConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
joinConfiguration:
discovery: {}
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: ${IBMVPC_CLUSTER_CLASS_NAME}-md-0
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
cloud-provider: external
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCMachineTemplate
metadata:
name: ${IBMVPC_CLUSTER_CLASS_NAME}-control-plane-machinetemplate
spec:
template:
spec:
bootVolume:
sizeGiB: ${IBMVPC_CONTROLPLANE_BOOT_VOLUME_SIZEGIB:=20}
image:
name: ${IBMVPC_IMAGE_NAME}
profile: ${IBMVPC_PROFILE}
sshKeys:
- name: ${IBMVPC_SSHKEY_NAME}
zone: ${IBMVPC_ZONE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCMachineTemplate
metadata:
name: ${IBMVPC_CLUSTER_CLASS_NAME}-worker-machinetemplate
spec:
template:
spec:
bootVolume:
sizeGiB: ${IBMVPC_WORKER_BOOT_VOLUME_SIZEGIB:=20}
image:
name: ${IBMVPC_IMAGE_NAME}
profile: ${IBMVPC_PROFILE}
sshKeys:
- name: ${IBMVPC_SSHKEY_NAME}
zone: ${IBMVPC_ZONE}
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: crs-cloud-conf
spec:
clusterSelector:
matchLabels:
ccm: external
resources:
- kind: Secret
name: ibm-credential
- kind: ConfigMap
name: ibm-cfg
- kind: ConfigMap
name: cloud-controller-manager-addon
strategy: ApplyOnce
---
apiVersion: v1
data:
ibm-cloud-conf.yaml: |-
apiVersion: v1
kind: ConfigMap
metadata:
name: ibm-cloud-config
namespace: kube-system
data:
ibm.conf: |
[global]
version = 1.1.0
[kubernetes]
config-file = ""
[provider]
cluster-default-provider = g2
accountID = ${IBMACCOUNT_ID}
clusterID = ${CLUSTER_NAME}
g2workerServiceAccountID = ${IBMACCOUNT_ID}
g2Credentials = /etc/ibm-secret/ibmcloud_api_key
g2ResourceGroupName = ${IBMVPC_RESOURCEGROUP_NAME:=""}
g2VpcSubnetNames = "${CLUSTER_NAME}-subnet"
g2VpcName = ${IBMVPC_NAME:=""}
region = ${IBMVPC_REGION:=""}
kind: ConfigMap
metadata:
name: ibm-cfg
---
apiVersion: v1
kind: Secret
metadata:
name: ibm-credential
stringData:
ibm-credential.yaml: |-
apiVersion: v1
kind: Secret
metadata:
name: ibm-cloud-credential
namespace: kube-system
data:
ibmcloud_api_key: ${BASE64_API_KEY}
type: addons.cluster.x-k8s.io/resource-set
---
apiVersion: v1
data:
ibm-ccm-external.yaml: |-
apiVersion: v1
kind: ServiceAccount
metadata:
name: cloud-controller-manager
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cloud-controller-manager:apiserver-authentication-reader
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: extension-apiserver-authentication-reader
subjects:
- apiGroup: ""
kind: ServiceAccount
name: cloud-controller-manager
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: system:cloud-controller-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:cloud-controller-manager
subjects:
- kind: ServiceAccount
name: cloud-controller-manager
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: system:cloud-controller-manager
rules:
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- update
- apiGroups:
- ""
resources:
- nodes
verbs:
- "*"
- apiGroups:
- ""
resources:
- nodes/status
verbs:
- patch
- apiGroups:
- ""
resources:
- services
verbs:
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- services/status
verbs:
- patch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- create
- get
- list
- watch
- update
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
- endpoints
verbs:
- create
- get
- list
- watch
- update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- "coordination.k8s.io"
resources:
- leases
verbs:
- create
- get
- list
- watch
- update
- apiGroups:
- ""
resourceNames:
- node-controller
- service-controller
resources:
- serviceaccounts/token
verbs:
- create
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ibm-cloud-controller-manager
namespace: kube-system
labels:
k8s-app: ibm-cloud-controller-manager
spec:
selector:
matchLabels:
k8s-app: ibm-cloud-controller-manager
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
k8s-app: ibm-cloud-controller-manager
spec:
nodeSelector:
node-role.kubernetes.io/control-plane: ""
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
effect: NoSchedule
- key: node-role.kubernetes.io/master
effect: NoSchedule
operator: Exists
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/not-ready
effect: NoSchedule
operator: Exists
serviceAccountName: cloud-controller-manager
containers:
- name: ibm-cloud-controller-manager
image: gcr.io/k8s-staging-capi-ibmcloud/powervs-cloud-controller-manager:6c98ec5
args:
- --v=2
- --cloud-provider=ibm
- --cloud-config=/etc/cloud/ibm.conf
- --use-service-account-credentials=true
resources:
requests:
cpu: 200m
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /etc/cloud
name: ibm-config-volume
readOnly: true
- mountPath: /etc/ibm-secret
name: ibm-secret
hostNetwork: true
volumes:
- name: ibm-config-volume
configMap:
name: ibm-cloud-config
- name: ibm-secret
secret:
secretName: ibm-cloud-credential
kind: ConfigMap
metadata:
name: cloud-controller-manager-addon