-
Notifications
You must be signed in to change notification settings - Fork 296
/
cluster-template.yaml
210 lines (210 loc) · 6.22 KB
/
cluster-template.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
---
apiVersion: cluster.x-k8s.io/v1alpha4
kind: Cluster
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.0.0/16
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
kind: KubeadmControlPlane
name: '${CLUSTER_NAME}'
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: VSphereCluster
name: '${CLUSTER_NAME}'
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: HAProxyLoadBalancer
metadata:
labels:
cluster.x-k8s.io/cluster-name: '${CLUSTER_NAME}'
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
spec:
user:
authorizedKeys:
- '${VSPHERE_SSH_AUTHORIZED_KEY}'
name: capv
virtualMachineConfiguration:
cloneMode: linkedClone
datacenter: '${VSPHERE_DATACENTER}'
datastore: '${VSPHERE_DATASTORE}'
diskGiB: 25
folder: '${VSPHERE_FOLDER}'
memoryMiB: 8192
network:
devices:
- dhcp4: true
networkName: '${VSPHERE_NETWORK}'
numCPUs: 2
resourcePool: '${VSPHERE_RESOURCE_POOL}'
server: '${VSPHERE_SERVER}'
template: '${VSPHERE_HAPROXY_TEMPLATE}'
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: VSphereCluster
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
spec:
cloudProviderConfiguration:
global:
insecure: true
secretName: cloud-provider-vsphere-credentials
secretNamespace: kube-system
network:
name: '${VSPHERE_NETWORK}'
providerConfig:
cloud:
controllerImage: gcr.io/cloud-provider-vsphere/cpi/release/manager:v1.2.1
storage:
attacherImage: quay.io/k8scsi/csi-attacher:v2.0.0
controllerImage: gcr.io/cloud-provider-vsphere/csi/release/driver:v2.0.0
livenessProbeImage: quay.io/k8scsi/livenessprobe:v1.1.0
metadataSyncerImage: gcr.io/cloud-provider-vsphere/csi/release/syncer:v2.0.0
nodeDriverImage: gcr.io/cloud-provider-vsphere/csi/release/driver:v2.0.0
provisionerImage: quay.io/k8scsi/csi-provisioner:v1.4.0
registrarImage: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0
virtualCenter:
${VSPHERE_SERVER}:
datacenters: '${VSPHERE_DATACENTER}'
workspace:
datacenter: '${VSPHERE_DATACENTER}'
datastore: '${VSPHERE_DATASTORE}'
folder: '${VSPHERE_FOLDER}'
resourcePool: '${VSPHERE_RESOURCE_POOL}'
server: '${VSPHERE_SERVER}'
loadBalancerRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: HAProxyLoadBalancer
name: '${CLUSTER_NAME}'
server: '${VSPHERE_SERVER}'
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: VSphereMachineTemplate
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
spec:
template:
spec:
cloneMode: linkedClone
datacenter: '${VSPHERE_DATACENTER}'
datastore: '${VSPHERE_DATASTORE}'
diskGiB: 25
folder: '${VSPHERE_FOLDER}'
memoryMiB: 8192
network:
devices:
- dhcp4: true
networkName: '${VSPHERE_NETWORK}'
numCPUs: 2
resourcePool: '${VSPHERE_RESOURCE_POOL}'
server: '${VSPHERE_SERVER}'
template: '${VSPHERE_TEMPLATE}'
---
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
kind: KubeadmControlPlane
metadata:
name: '${CLUSTER_NAME}'
namespace: '${NAMESPACE}'
spec:
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: VSphereMachineTemplate
name: '${CLUSTER_NAME}'
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
extraArgs:
cloud-provider: external
controllerManager:
extraArgs:
cloud-provider: external
initConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
name: '{{ ds.meta_data.hostname }}'
joinConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
name: '{{ ds.meta_data.hostname }}'
preKubeadmCommands:
- hostname "{{ ds.meta_data.hostname }}"
- echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
- echo "127.0.0.1 localhost" >>/etc/hosts
- echo "127.0.0.1 {{ ds.meta_data.hostname }}" >>/etc/hosts
- echo "{{ ds.meta_data.hostname }}" >/etc/hostname
useExperimentalRetryJoin: true
users:
- name: capv
sshAuthorizedKeys:
- '${VSPHERE_SSH_AUTHORIZED_KEY}'
sudo: ALL=(ALL) NOPASSWD:ALL
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
version: '${KUBERNETES_VERSION}'
---
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4
kind: KubeadmConfigTemplate
metadata:
name: '${CLUSTER_NAME}-md-0'
namespace: '${NAMESPACE}'
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
name: '{{ ds.meta_data.hostname}}'
preKubeadmCommands:
- hostname "{{ ds.meta_data.hostname }}"
- echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
- echo "127.0.0.1 localhost" >>/etc/hosts
- echo "127.0.0.1 {{ ds.meta_data.hostname }}" >>/etc/hosts
- echo "{{ ds.meta_data.hostname }}" >/etc/hostname
users:
- name: capv
sshAuthorizedKeys:
- '${VSPHERE_SSH_AUTHORIZED_KEY}'
sudo: ALL=(ALL) NOPASSWD:ALL
---
apiVersion: cluster.x-k8s.io/v1alpha4
kind: MachineDeployment
metadata:
labels:
cluster.x-k8s.io/cluster-name: '${CLUSTER_NAME}'
name: '${CLUSTER_NAME}-md-0'
namespace: '${NAMESPACE}'
spec:
clusterName: '${CLUSTER_NAME}'
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels: {}
template:
metadata:
labels:
cluster.x-k8s.io/cluster-name: '${CLUSTER_NAME}'
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4
kind: KubeadmConfigTemplate
name: '${CLUSTER_NAME}-md-0'
clusterName: '${CLUSTER_NAME}'
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: VSphereMachineTemplate
name: '${CLUSTER_NAME}'
version: '${KUBERNETES_VERSION}'