@@ -186,3 +186,129 @@ Users can just run kubectl apply -f <URL for YAML BUNDLE> to install the project
186
186
``` sh
187
187
kubectl apply -f https://raw.githubusercontent.com/< org> /cluster-api-provider-metal-stack/< tag or branch> /dist/install.yaml
188
188
```
189
+
190
+ ## Quick opinionated Cluster Bootstrap and move
191
+
192
+ This is a short and opinionated fast track to create and move a cluster using our provider.
193
+ In contrast to a guide and the README, we do not explain all commands and try to be concise.
194
+
195
+ Configure your clusterctl:
196
+
197
+ ``` yaml
198
+ # ~/.config/cluster-api/clusterctl.yaml
199
+ providers :
200
+ - name : " metal-stack"
201
+ url : " https://github.com/metal-stack/cluster-api-provider-metal-stack/releases/latest/download/infrastructure-components.yaml"
202
+ # or for PRs
203
+ # url: "${HOME}/path/to/infrastructure-metal-stack/v0.4.0/infrastructure-components.yaml"
204
+ # generate with:
205
+ # IMG_TAG=branch-name RELEASE_DIR=${HOME}/path/to/infrastructure-metal-stack/v0.4.0 make release-manifests
206
+ type : InfrastructureProvider
207
+ ` ` `
208
+
209
+ Set environment variables. Don't forget to update them along the way.
210
+
211
+ ` ` ` bash
212
+ export EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION=true
213
+
214
+ export METAL_API_HMAC=
215
+ export METAL_API_HMAC_AUTH_TYPE=
216
+ export METAL_API_URL=
217
+
218
+ export METAL_PARTITION=
219
+ export METAL_PROJECT_ID=
220
+ export METAL_NODE_NETWORK_ID=
221
+
222
+ export FIREWALL_MACHINE_IMAGE=
223
+ export FIREWALL_MACHINE_SIZE=
224
+
225
+ export CONTROL_PLANE_MACHINE_IMAGE=
226
+ export CONTROL_PLANE_MACHINE_SIZE=
227
+ export WORKER_MACHINE_IMAGE=
228
+ export WORKER_MACHINE_SIZE=
229
+
230
+ export CLUSTER_NAME=
231
+ export NAMESPACE=default
232
+ export KUBERNETES_VERSION=v1.30.6
233
+
234
+ export CONTROL_PLANE_MACHINE_COUNT=1
235
+ export WORKER_MACHINE_COUNT=1
236
+
237
+ # Additional envs
238
+ export repo_path=$HOME/path/to/cluster-api-provider-metal-stack
239
+ export project_name=
240
+ export tenant_name=
241
+ export firewall_id=
242
+ ```
243
+
244
+ Create firewall if needed:
245
+
246
+ ``` bash
247
+ metalctl project create --name $project_name --tenant $tenant_name --description " Cluster API test project"
248
+ metalctl network allocate --description " Node network for $CLUSTER_NAME " --name $CLUSTER_NAME --project $METAL_PROJECT_ID --partition $METAL_PARTITION
249
+ metalctl firewall create --description " Firewall for $CLUSTER_NAME cluster" --name firewall-$CLUSTER_NAME --hostname firewall-$CLUSTER_NAME --project $METAL_PROJECT_ID --partition $METAL_PARTITION --image $FIREWALL_MACHINE_IMAGE --size $FIREWALL_MACHINE_SIZE --firewall-rules-file $repo_path /config/target-cluster/firewall-rules.yaml --networks internet,$METAL_NODE_NETWORK_ID
250
+ ```
251
+
252
+ ``` bash
253
+ kind create cluster --name bootstrap
254
+ kind export kubeconfig --name bootstrap --kubeconfig kind-bootstrap.kubeconfig
255
+
256
+ clusterctl init --infrastructure metal-stack --kubeconfig kind-bootstrap.kubeconfig
257
+ clusterctl generate cluster $CLUSTER_NAME --infrastructure metal-stack > cluster-$CLUSTER_NAME .yaml
258
+ kubectl apply -f cluster-$CLUSTER_NAME .yaml
259
+
260
+ # once the control plane node is in phoned home
261
+ metalctl machine consolepassword $firewall_id
262
+ metalctl machine console --ipmi $firewall_id
263
+ # sudo systemctl restart frr
264
+ # ~.
265
+
266
+ kubectl --kubeconfig kind-bootstrap.kubeconfig get metalstackmachines.infrastructure.cluster.x-k8s.io
267
+ cp_machine_id=TODO metalctl machine console --ipmi $cp_machine_id
268
+ # ip r
269
+ # sudo systemctl restart kubeadm
270
+ # crictl ps
271
+ # ~.
272
+
273
+ clusterctl get kubeconfig > capms-cluster.kubeconfig
274
+
275
+ # metal-ccm
276
+ cat $repo_path /config/target-cluster/metal-ccm.yaml | envsubst | kubectl --kubeconfig capms-cluster.kubeconfig apply -f -
277
+
278
+ # cni
279
+ kubectl --kubeconfig=capms-cluster.kubeconfig create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.2/manifests/tigera-operator.yaml
280
+ cat << EOF | kubectl --kubeconfig=capms-cluster.kubeconfig create -f -
281
+ apiVersion: operator.tigera.io/v1
282
+ kind: Installation
283
+ metadata:
284
+ name: default
285
+ spec:
286
+ # Configures Calico networking.
287
+ calicoNetwork:
288
+ bgp: Disabled
289
+ ipPools:
290
+ - name: default-ipv4-ippool
291
+ blockSize: 26
292
+ cidr: 10.240.0.0/12
293
+ encapsulation: None
294
+ mtu: 1440
295
+ cni:
296
+ ipam:
297
+ type: HostLocal
298
+ type: Calico
299
+ EOF
300
+
301
+ watch kubectl --kubeconfig kind-bootstrap.kubeconfig get cluster,metalstackcluster,machine,metalstackmachine,kubeadmcontrolplanes,kubeadmconfigs
302
+ # until everything is ready
303
+ ```
304
+
305
+ Now you are able to move the cluster resources as you wish:
306
+
307
+ ``` bash
308
+ clusterctl init --infrastructure metal-stack --kubeconfig capms-cluster.kubeconfig
309
+
310
+ clusterctl move --kubeconfig kind-bootstrap.kubeconfig --to-kubeconfig capms-cluster.kubeconfig
311
+ # everything as expected
312
+ kubectl --kubeconfig kind-bootstrap.kubeconfig get cluster,metalstackcluster,machine,metalstackmachine,kubeadmcontrolplanes,kubeadmconfigs
313
+ kubectl --kubeconfig capms-cluster.kubeconfig get cluster,metalstackcluster,machine,metalstackmachine,kubeadmcontrolplanes,kubeadmconfigs
314
+ ```
0 commit comments